Merge pull request #1558 from vodik/fix-tests-under-pipenv
Fix unit tests when run with PYTHONDONTWRITEBYTECODE
This commit is contained in:
commit
80bece497a
@ -10,6 +10,7 @@ import os
|
||||
import ast
|
||||
import tempfile
|
||||
from fractions import Fraction
|
||||
import pytest
|
||||
|
||||
|
||||
def test_basics():
|
||||
@ -50,6 +51,8 @@ def test_import_error_reporting():
|
||||
assert _import_error_test() is not None
|
||||
|
||||
|
||||
@pytest.mark.skipif(os.environ.get('PYTHONDONTWRITEBYTECODE'),
|
||||
reason="Bytecode generation is suppressed")
|
||||
def test_import_autocompiles():
|
||||
"Test that (import) byte-compiles the module."
|
||||
|
||||
|
@ -24,10 +24,12 @@ def hr(s=""):
|
||||
|
||||
|
||||
def run_cmd(cmd, stdin_data=None, expect=0, dontwritebytecode=False):
|
||||
env = None
|
||||
env = dict(os.environ)
|
||||
if dontwritebytecode:
|
||||
env = dict(os.environ)
|
||||
env["PYTHONDONTWRITEBYTECODE"] = "1"
|
||||
else:
|
||||
env.pop("PYTHONDONTWRITEBYTECODE", None)
|
||||
|
||||
cmd = shlex.split(cmd)
|
||||
cmd[0] = os.path.join(hy_dir, cmd[0])
|
||||
p = subprocess.Popen(cmd,
|
||||
|
Loading…
Reference in New Issue
Block a user