mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 14:34:31 +08:00
add proper deprecation warnings and warnings become error messages in Jedi; also deprecate CallSignature.call_name
This commit is contained in:
@@ -27,6 +27,9 @@ def pytest_addoption(parser):
|
|||||||
|
|
||||||
|
|
||||||
def pytest_configure(config):
|
def pytest_configure(config):
|
||||||
|
import warnings
|
||||||
|
warnings.simplefilter("error")
|
||||||
|
|
||||||
global jedi_cache_directory_orig, jedi_cache_directory_temp
|
global jedi_cache_directory_orig, jedi_cache_directory_temp
|
||||||
jedi_cache_directory_orig = jedi.settings.cache_directory
|
jedi_cache_directory_orig = jedi.settings.cache_directory
|
||||||
jedi_cache_directory_temp = tempfile.mkdtemp(prefix='jedi-test-')
|
jedi_cache_directory_temp = tempfile.mkdtemp(prefix='jedi-test-')
|
||||||
|
|||||||
@@ -583,7 +583,14 @@ class CallSignature(Definition):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def call_name(self):
|
def call_name(self):
|
||||||
""" The name (e.g. 'isinstance') as a string. """
|
"""
|
||||||
|
.. deprecated:: 0.8.0
|
||||||
|
Use :attr:`.name` instead.
|
||||||
|
.. todo:: Remove!
|
||||||
|
|
||||||
|
The name (e.g. 'isinstance') as a string.
|
||||||
|
"""
|
||||||
|
warnings.warn("Use name instead.", DeprecationWarning)
|
||||||
return unicode(self._definition.name)
|
return unicode(self._definition.name)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
@@ -603,4 +610,5 @@ class Param(Definition):
|
|||||||
|
|
||||||
A function to get the whole code of the param.
|
A function to get the whole code of the param.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn("Use description instead.", DeprecationWarning)
|
||||||
return self.description
|
return self.description
|
||||||
|
|||||||
@@ -193,7 +193,8 @@ def test_signature_is_definition():
|
|||||||
|
|
||||||
# Now compare all the attributes that a CallSignature must also have.
|
# Now compare all the attributes that a CallSignature must also have.
|
||||||
for attr_name in dir(definition):
|
for attr_name in dir(definition):
|
||||||
if attr_name.startswith('_') or attr_name == 'defined_names':
|
dont_scan = ['defined_names', 'line_nr', 'start_pos']
|
||||||
|
if attr_name.startswith('_') or attr_name in dont_scan:
|
||||||
continue
|
continue
|
||||||
attribute = getattr(definition, attr_name)
|
attribute = getattr(definition, attr_name)
|
||||||
signature_attribute = getattr(signature, attr_name)
|
signature_attribute = getattr(signature, attr_name)
|
||||||
|
|||||||
Reference in New Issue
Block a user