From 0bd08618afc87e5b787ca3a0b1efe3622bad2e7e Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 3 Apr 2019 20:36:53 +1300 Subject: [PATCH] Change _py_abc to workaround current issue, and run test with PYTHONPATH linking to Lib directory. --- Lib/_py_abc.py | 2 +- tests/snippets/abc_test.py | 3 --- tests/test_snippets.py | 3 ++- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Lib/_py_abc.py b/Lib/_py_abc.py index 3c3aa8e3d..60adace9b 100644 --- a/Lib/_py_abc.py +++ b/Lib/_py_abc.py @@ -33,7 +33,7 @@ class ABCMeta(type): _abc_invalidation_counter = 0 def __new__(mcls, name, bases, namespace, **kwargs): - cls = super().__new__(mcls, name, bases, namespace, **kwargs) + cls = type.__new__(mcls, name, bases, namespace, **kwargs) # Compute set of abstract method names abstracts = {name for name, value in namespace.items() diff --git a/tests/snippets/abc_test.py b/tests/snippets/abc_test.py index a5b53ea61..494f967be 100644 --- a/tests/snippets/abc_test.py +++ b/tests/snippets/abc_test.py @@ -1,4 +1 @@ -import sys -sys.path.append('Lib') - import abc diff --git a/tests/test_snippets.py b/tests/test_snippets.py index 7edbd7b7e..b3bc79ee7 100644 --- a/tests/test_snippets.py +++ b/tests/test_snippets.py @@ -27,7 +27,7 @@ TEST_DIRS = { } CPYTHON_RUNNER_DIR = os.path.abspath(os.path.join(ROOT_DIR, 'py_code_object')) RUSTPYTHON_RUNNER_DIR = os.path.abspath(os.path.join(ROOT_DIR)) - +RUSTPYTHON_LIB_DIR = os.path.abspath(os.path.join(ROOT_DIR, "Lib")) @contextlib.contextmanager def pushd(path): @@ -73,6 +73,7 @@ def run_via_rustpython(filename, test_type): env = os.environ.copy() env['RUST_LOG'] = 'info,cargo=error,jobserver=error' env['RUST_BACKTRACE'] = '1' + env['PYTHONPATH'] = RUSTPYTHON_LIB_DIR target = 'release' if env.get('CODE_COVERAGE', 'false') == 'true':