From dbf4356aac2c6aa7c99eed6e72aa188795712d0c Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Mon, 11 Feb 2019 14:47:19 -0700 Subject: [PATCH] Use the code directory instead of cwd for python path --- tests/support/case.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/support/case.py b/tests/support/case.py index 90e02a5278..a8b8770a6f 100644 --- a/tests/support/case.py +++ b/tests/support/case.py @@ -275,7 +275,10 @@ class ShellTestCase(TestCase, AdaptedConfigurationTestCaseMixin): popen_kwargs['cwd'] = os.getcwd() if 'env' not in popen_kwargs: popen_kwargs['env'] = os.environ.copy() - popen_kwargs['env'][b'PYTHONPATH'] = os.getcwd().encode() + if sys.version_info[0] < 3: + popen_kwargs['env'][b'PYTHONPATH'] = CODE_DIR.encode() + else: + popen_kwargs['env']['PYTHONPATH'] = CODE_DIR else: cmd = 'PYTHONPATH=' python_path = os.environ.get('PYTHONPATH', None)