Skip to content

Commit 8324849

Browse files
Fix redefinition of pytest_configure
Signed-off-by: Whitney Tsang <[email protected]>
1 parent 6e2fff0 commit 8324849

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

python/test/unit/conftest.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55

66
def pytest_configure(config):
77
config.addinivalue_line("markers", "interpreter: indicate whether interpreter supports the test")
8+
worker_id = os.getenv("PYTEST_XDIST_WORKER")
9+
# On Windows, use a dedicated Triton cache per pytest worker to avoid PermissionError.
10+
if os.name == "nt" and worker_id:
11+
os.environ["TRITON_CACHE_DIR"] = tempfile.mkdtemp(prefix="triton-")
12+
if os.name == "nt":
13+
pytest.mark.forked = pytest.mark.skip(reason="Windows doesn't fork")
814

915

1016
def pytest_addoption(parser):
@@ -27,12 +33,3 @@ def fresh_triton_cache():
2733
yield tmpdir
2834
finally:
2935
os.environ.pop("TRITON_CACHE_DIR", None)
30-
31-
32-
def pytest_configure(config):
33-
worker_id = os.getenv("PYTEST_XDIST_WORKER")
34-
# On Windows, use a dedicated Triton cache per pytest worker to avoid PermissionError.
35-
if os.name == "nt" and worker_id:
36-
os.environ["TRITON_CACHE_DIR"] = tempfile.mkdtemp(prefix="triton-")
37-
if os.name == "nt":
38-
pytest.mark.forked = pytest.mark.skip(reason="Windows doesn't fork")

0 commit comments

Comments
 (0)