Use Script everywhere where cwd_at is used, otherwise Python 2.7 is annoying

This commit is contained in:
Dave Halter
2017-12-30 03:55:23 +01:00
parent 0ed9e1c249
commit a14f665b5a
6 changed files with 9 additions and 9 deletions

View File

@@ -30,9 +30,9 @@ def cwd_at(path):
""" """
def decorator(func): def decorator(func):
@functools.wraps(func) @functools.wraps(func)
def wrapper(*args, **kwds): def wrapper(Script, **kwds):
with set_cwd(path): with set_cwd(path):
return func(*args, **kwds) return func(Script, **kwds)
return wrapper return wrapper
return decorator return decorator

View File

@@ -15,7 +15,7 @@ def check_module_test(Script, code):
@cwd_at('test/test_evaluate/buildout_project/src/proj_name') @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( parent = _get_parent_dir_with_file(
os.path.abspath(os.curdir), 'buildout.cfg') os.path.abspath(os.curdir), 'buildout.cfg')
assert parent is not None 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') @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')) scripts = _get_buildout_script_paths(os.path.abspath('./module_name.py'))
assert len(scripts) == 1 assert len(scripts) == 1
curdir = os.path.abspath(os.curdir) curdir = os.path.abspath(os.curdir)

View File

@@ -13,14 +13,14 @@ def test_simple(evaluator):
def test_fake_loading(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') string, = builtin.py__getattribute__('str')
from_name = compiled.context.create_from_name(evaluator, string, '__init__') from_name = compiled.context.create_from_name(evaluator, string, '__init__')
assert from_name.tree_node assert from_name.tree_node
def test_fake_docstr(evaluator): 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_.py__doc__()
assert next_.tree_node is not None assert next_.tree_node is not None
assert next_.py__doc__() == next.__doc__ assert next_.py__doc__() == next.__doc__

View File

@@ -36,7 +36,7 @@ def test_call_signatures_stdlib(Script):
# Check only on linux 64 bit platform and Python3.4. # 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)') @pytest.mark.skipif('sys.platform != "linux" or sys.maxsize <= 2**32 or sys.version_info[:2] != (3, 4)')
@cwd_at('test/test_evaluate') @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 ``__init__`` extension modules are also packages and Jedi should understand
that. that.

View File

@@ -44,7 +44,7 @@ def generate_pyc():
@cwd_at('test/test_evaluate') @cwd_at('test/test_evaluate')
def test_pyc(): def test_pyc(Script):
""" """
The list of completion must be greater than 2. The list of completion must be greater than 2.
""" """

View File

@@ -79,7 +79,7 @@ class TestSetupReadline(unittest.TestCase):
assert len(set(self.completions(s)).symmetric_difference(goal)) < 20 assert len(set(self.completions(s)).symmetric_difference(goal)) < 20
@cwd_at('test') @cwd_at('test')
def test_local_import(self): def test_local_import(self, _):
s = 'import test_utils' s = 'import test_utils'
assert self.completions(s) == [s] assert self.completions(s) == [s]