mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Use Script everywhere where cwd_at is used, otherwise Python 2.7 is annoying
This commit is contained in:
@@ -30,9 +30,9 @@ def cwd_at(path):
|
||||
"""
|
||||
def decorator(func):
|
||||
@functools.wraps(func)
|
||||
def wrapper(*args, **kwds):
|
||||
def wrapper(Script, **kwds):
|
||||
with set_cwd(path):
|
||||
return func(*args, **kwds)
|
||||
return func(Script, **kwds)
|
||||
return wrapper
|
||||
return decorator
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ def check_module_test(Script, code):
|
||||
|
||||
|
||||
@cwd_at('test/test_evaluate/buildout_project/src/proj_name')
|
||||
def test_parent_dir_with_file():
|
||||
def test_parent_dir_with_file(Script):
|
||||
parent = _get_parent_dir_with_file(
|
||||
os.path.abspath(os.curdir), 'buildout.cfg')
|
||||
assert parent is not None
|
||||
@@ -23,7 +23,7 @@ def test_parent_dir_with_file():
|
||||
|
||||
|
||||
@cwd_at('test/test_evaluate/buildout_project/src/proj_name')
|
||||
def test_buildout_detection():
|
||||
def test_buildout_detection(Script):
|
||||
scripts = _get_buildout_script_paths(os.path.abspath('./module_name.py'))
|
||||
assert len(scripts) == 1
|
||||
curdir = os.path.abspath(os.curdir)
|
||||
|
||||
@@ -13,14 +13,14 @@ def test_simple(evaluator):
|
||||
|
||||
|
||||
def test_fake_loading(evaluator):
|
||||
builtin = compiled.get_special_object(evaluator, 'BUILTINS')
|
||||
builtin = compiled.get_special_object(evaluator, u'BUILTINS')
|
||||
string, = builtin.py__getattribute__('str')
|
||||
from_name = compiled.context.create_from_name(evaluator, string, '__init__')
|
||||
assert from_name.tree_node
|
||||
|
||||
|
||||
def test_fake_docstr(evaluator):
|
||||
next_ = compiled.builtin_from_name(evaluator, 'next')
|
||||
next_ = compiled.builtin_from_name(evaluator, u'next')
|
||||
assert next_.py__doc__()
|
||||
assert next_.tree_node is not None
|
||||
assert next_.py__doc__() == next.__doc__
|
||||
|
||||
@@ -36,7 +36,7 @@ def test_call_signatures_stdlib(Script):
|
||||
# Check only on linux 64 bit platform and Python3.4.
|
||||
@pytest.mark.skipif('sys.platform != "linux" or sys.maxsize <= 2**32 or sys.version_info[:2] != (3, 4)')
|
||||
@cwd_at('test/test_evaluate')
|
||||
def test_init_extension_module():
|
||||
def test_init_extension_module(Script):
|
||||
"""
|
||||
``__init__`` extension modules are also packages and Jedi should understand
|
||||
that.
|
||||
|
||||
@@ -44,7 +44,7 @@ def generate_pyc():
|
||||
|
||||
|
||||
@cwd_at('test/test_evaluate')
|
||||
def test_pyc():
|
||||
def test_pyc(Script):
|
||||
"""
|
||||
The list of completion must be greater than 2.
|
||||
"""
|
||||
|
||||
@@ -79,7 +79,7 @@ class TestSetupReadline(unittest.TestCase):
|
||||
assert len(set(self.completions(s)).symmetric_difference(goal)) < 20
|
||||
|
||||
@cwd_at('test')
|
||||
def test_local_import(self):
|
||||
def test_local_import(self, _):
|
||||
s = 'import test_utils'
|
||||
assert self.completions(s) == [s]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user