Skip to content

Commit 94a35b2

Browse files
committed
Do not change PYTHONPATH or sys.path on workers
Fix #376
1 parent 261d418 commit 94a35b2

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

changelog/376.feature.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
The current directory is no longer added ``sys.path`` on workers.
2+
3+
This behavior is surprising because it makes xdist runs and non-xdist runs to potentially behave differently.

xdist/remote.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -251,17 +251,12 @@ def remote_initconfig(option_dict, args):
251251

252252

253253
if __name__ == "__channelexec__":
254+
import py
255+
254256
channel = channel # noqa
255257
workerinput, args, option_dict = channel.receive()
256-
importpath = os.getcwd()
257-
sys.path.insert(0, importpath) # XXX only for remote situations
258-
os.environ["PYTHONPATH"] = (
259-
importpath + os.pathsep + os.environ.get("PYTHONPATH", "")
260-
)
261258
os.environ["PYTEST_XDIST_WORKER"] = workerinput["workerid"]
262259
os.environ["PYTEST_XDIST_WORKER_COUNT"] = str(workerinput["workercount"])
263-
# os.environ['PYTHONPATH'] = importpath
264-
import py
265260

266261
config = remote_initconfig(option_dict, args)
267262
config._parser.prog = os.path.basename(workerinput["mainargv"][0])

0 commit comments

Comments
 (0)