Preserve any existing PYTHONPATH in tests
This commit is contained in:
parent
42189e3087
commit
fddd690a58
|
@ -101,9 +101,15 @@ def dev_server(xprocess, request, tmp_path):
|
||||||
class Starter(ProcessStarter):
|
class Starter(ProcessStarter):
|
||||||
args = [sys.executable, run_path, name, json.dumps(kwargs)]
|
args = [sys.executable, run_path, name, json.dumps(kwargs)]
|
||||||
# Extend the existing env, otherwise Windows and CI fails.
|
# Extend the existing env, otherwise Windows and CI fails.
|
||||||
# Modules will be imported from tmp_path for the reloader.
|
# Modules will be imported from tmp_path for the reloader
|
||||||
|
# but any existing PYTHONPATH is preserved.
|
||||||
# Unbuffered output so the logs update immediately.
|
# Unbuffered output so the logs update immediately.
|
||||||
env = {**os.environ, "PYTHONPATH": str(tmp_path), "PYTHONUNBUFFERED": "1"}
|
original_python_path = os.getenv("PYTHONPATH")
|
||||||
|
if original_python_path:
|
||||||
|
new_python_path = os.pathsep.join((original_python_path, str(tmp_path)))
|
||||||
|
else:
|
||||||
|
new_python_path = str(tmp_path)
|
||||||
|
env = {**os.environ, "PYTHONPATH": new_python_path, "PYTHONUNBUFFERED": "1"}
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def pattern(self):
|
def pattern(self):
|
||||||
|
|
Loading…
Reference in New Issue