Merge pull request #51584 from dwoz/script_fixes

[2019.2] Use the code directory instead of cwd for python path
This commit is contained in:
Daniel Wozniak 2019-02-12 11:43:45 -07:00 committed by GitHub
commit 1e0275eea3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -275,7 +275,10 @@ class ShellTestCase(TestCase, AdaptedConfigurationTestCaseMixin):
popen_kwargs['cwd'] = os.getcwd() popen_kwargs['cwd'] = os.getcwd()
if 'env' not in popen_kwargs: if 'env' not in popen_kwargs:
popen_kwargs['env'] = os.environ.copy() 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: else:
cmd = 'PYTHONPATH=' cmd = 'PYTHONPATH='
python_path = os.environ.get('PYTHONPATH', None) python_path = os.environ.get('PYTHONPATH', None)