Skip to content

Commit a6a9646

Browse files
committed
pytester: pop TOX_ENV_DIR from os.environ
Closes: pytest-dev#4378 Fixes: pytest-dev#4366
1 parent b131214 commit a6a9646

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

src/_pytest/pytester.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,7 @@ def __init__(self, request, tmpdir_factory):
502502
self.tmpdir = tmpdir_factory.mktemp(name, numbered=True)
503503
self.test_tmproot = tmpdir_factory.mktemp("tmp-" + name, numbered=True)
504504
os.environ["PYTEST_DEBUG_TEMPROOT"] = str(self.test_tmproot)
505+
os.environ.pop("TOX_ENV_DIR", None) # Ensure that it is not used for caching.
505506
self.plugins = []
506507
self._cwd_snapshot = CwdSnapshot()
507508
self._sys_path_snapshot = SysPathsSnapshot()

testing/test_cacheprovider.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,6 @@
1414
pytest_plugins = ("pytester",)
1515

1616

17-
@pytest.fixture(scope="module", autouse=True)
18-
def handle_env():
19-
"""Ensure env is like most of the tests expect it, i.e. not using tox."""
20-
orig_env = os.environ.pop("TOX_ENV_DIR", None)
21-
22-
yield
23-
24-
if orig_env is not None:
25-
os.environ["TOX_ENV_DIR"] = orig_env
26-
27-
2817
class TestNewAPI(object):
2918
def test_config_cache_makedir(self, testdir):
3019
testdir.makeini("[pytest]")

0 commit comments

Comments
 (0)