tests: use sys.dont_write_bytecode

Setting PYTHONDONTWRITEBYTECODE in the environment does not change it
for the current process.
This commit is contained in:
Daniel Hahler 2019-11-15 23:12:25 +01:00
parent 99f487864c
commit 1abb08d52f
1 changed files with 3 additions and 3 deletions

View File

@ -253,7 +253,7 @@ def test_cache_show(testdir):
class TestLastFailed:
def test_lastfailed_usecase(self, testdir, monkeypatch):
monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", "1")
monkeypatch.setattr("sys.dont_write_bytecode", True)
p = testdir.makepyfile(
"""
def test_1():
@ -345,7 +345,7 @@ class TestLastFailed:
result.stdout.no_fnmatch_line("*test_a.py*")
def test_lastfailed_difference_invocations(self, testdir, monkeypatch):
monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", "1")
monkeypatch.setattr("sys.dont_write_bytecode", True)
testdir.makepyfile(
test_a="""\
def test_a1():
@ -379,7 +379,7 @@ class TestLastFailed:
result.stdout.fnmatch_lines(["*1 failed*1 desel*"])
def test_lastfailed_usecase_splice(self, testdir, monkeypatch):
monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", "1")
monkeypatch.setattr("sys.dont_write_bytecode", True)
testdir.makepyfile(
"""\
def test_1():