TST Adds cwd to PYTHONPATH in assert_run_python_script
@@ -877,10 +877,14 @@ def assert_run_python_script(source_code, timeout=60):
cmd = [sys.executable, source_file]
cwd = op.normpath(op.join(op.dirname(sklearn.__file__), '..'))
env = os.environ.copy()
+ try:
+ env["PYTHONPATH"] = os.pathsep.join([cwd, env["PYTHONPATH"]])
+ except KeyError:
+ env["PYTHONPATH"] = cwd
kwargs = {
'cwd': cwd,
'stderr': STDOUT,
- 'env': env,
+ 'env': env
}
# If coverage is running, pass the config file to the subprocess
coverage_rc = os.environ.get("COVERAGE_PROCESS_START")
