From a14f665b5a4232e6a280ff6f7814ad8e67510cca Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Sat, 30 Dec 2017 03:55:23 +0100 Subject: [PATCH] Use Script everywhere where cwd_at is used, otherwise Python 2.7 is annoying --- test/helpers.py | 4 ++-- test/test_evaluate/test_buildout_detection.py | 4 ++-- test/test_evaluate/test_compiled.py | 4 ++-- test/test_evaluate/test_extension.py | 2 +- test/test_evaluate/test_pyc.py | 2 +- test/test_utils.py | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/helpers.py b/test/helpers.py index b29dd297..da3860dc 100644 --- a/test/helpers.py +++ b/test/helpers.py @@ -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 diff --git a/test/test_evaluate/test_buildout_detection.py b/test/test_evaluate/test_buildout_detection.py index dff59afe..41c02cdb 100644 --- a/test/test_evaluate/test_buildout_detection.py +++ b/test/test_evaluate/test_buildout_detection.py @@ -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) diff --git a/test/test_evaluate/test_compiled.py b/test/test_evaluate/test_compiled.py index a78b615e..440303ef 100644 --- a/test/test_evaluate/test_compiled.py +++ b/test/test_evaluate/test_compiled.py @@ -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__ diff --git a/test/test_evaluate/test_extension.py b/test/test_evaluate/test_extension.py index bbd422b9..7dfcfd0d 100644 --- a/test/test_evaluate/test_extension.py +++ b/test/test_evaluate/test_extension.py @@ -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. diff --git a/test/test_evaluate/test_pyc.py b/test/test_evaluate/test_pyc.py index de6286a1..d31254cc 100644 --- a/test/test_evaluate/test_pyc.py +++ b/test/test_evaluate/test_pyc.py @@ -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. """ diff --git a/test/test_utils.py b/test/test_utils.py index 2eb6e8ca..45053013 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -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]