diff options
Diffstat (limited to 'tests/test_process.py')
-rw-r--r-- | tests/test_process.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/test_process.py b/tests/test_process.py index c9a2f8ee..7508430c 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -39,7 +39,7 @@ class ProcessTest(CoverageTest): self.run_command("coverage run mycode.py") self.assert_exists(".coverage") - def test_environment(self): + def test_tests_dir_is_importable(self): # Checks that we can import modules from the tests directory at all! self.make_file("mycode.py", """\ import covmod1 @@ -53,6 +53,24 @@ class ProcessTest(CoverageTest): self.assert_exists(".coverage") assert out == 'done\n' + def test_coverage_run_envvar_isnt_in_python(self): + # Test that we aren't smearing COVERAGE_RUN all over the place. + self.make_file("envornot.py", """\ + import os + print(os.environ.get("COVERAGE_RUN", "nope")) + """) + out = self.run_command("python envornot.py") + assert out == "nope\n" + + def test_coverage_run_envvar_is_in_coveragerun(self): + # Test that we are setting COVERAGE_RUN when we run. + self.make_file("envornot.py", """\ + import os + print(os.environ.get("COVERAGE_RUN", "nope")) + """) + out = self.run_command("coverage run envornot.py") + assert out == "true\n" + def make_b_or_c_py(self): """Create b_or_c.py, used in a few of these tests.""" # "b_or_c.py b" will run 6 lines. |