Skip to content

Commit 1abb08d

Browse files
committed
tests: use sys.dont_write_bytecode
Setting PYTHONDONTWRITEBYTECODE in the environment does not change it for the current process.
1 parent 99f4878 commit 1abb08d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

testing/test_cacheprovider.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def pytest_configure(config):
253253

254254
class TestLastFailed:
255255
def test_lastfailed_usecase(self, testdir, monkeypatch):
256-
monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", "1")
256+
monkeypatch.setattr("sys.dont_write_bytecode", True)
257257
p = testdir.makepyfile(
258258
"""
259259
def test_1():
@@ -345,7 +345,7 @@ def test_always_fails():
345345
result.stdout.no_fnmatch_line("*test_a.py*")
346346

347347
def test_lastfailed_difference_invocations(self, testdir, monkeypatch):
348-
monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", "1")
348+
monkeypatch.setattr("sys.dont_write_bytecode", True)
349349
testdir.makepyfile(
350350
test_a="""\
351351
def test_a1():
@@ -379,7 +379,7 @@ def test_b1():
379379
result.stdout.fnmatch_lines(["*1 failed*1 desel*"])
380380

381381
def test_lastfailed_usecase_splice(self, testdir, monkeypatch):
382-
monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", "1")
382+
monkeypatch.setattr("sys.dont_write_bytecode", True)
383383
testdir.makepyfile(
384384
"""\
385385
def test_1():

0 commit comments

Comments
 (0)