respect sys.dont_write_bytecode and PYTHONDONTWRITEBYTECODE

This commit is contained in:
Benjamin Peterson
2011-07-13 13:33:54 -05:00
parent 14ceaf2459
commit 3cc8697744
3 changed files with 18 additions and 7 deletions

View File

@@ -277,3 +277,13 @@ def test_rewritten():
assert "@py_builtins" in globals()""")
sub.chmod(320)
assert testdir.runpytest().ret == 0
def test_dont_write_bytecode(self, testdir, monkeypatch):
testdir.makepyfile("""
import os
def test_no_bytecode():
assert "__pycache__" in __cached__
assert not os.path.exists(__cached__)
assert not os.path.exists(os.path.dirname(__cached__))""")
monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", "1")
assert testdir.runpytest().ret == 0