diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2011-08-08 22:24:51 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2011-08-08 22:24:51 -0400 |
commit | 669a609f88de252d41cd5b8510160c87ef6e65ba (patch) | |
tree | 5f9ffad31beaac55c7b88fbccfa2fcbad702f799 /test/test_process.py | |
parent | 829215d157dca64cd1d88be27908e73a084715a7 (diff) | |
download | python-coveragepy-git-669a609f88de252d41cd5b8510160c87ef6e65ba.tar.gz |
Control the test better; don't use os when cleaning up the path
Diffstat (limited to 'test/test_process.py')
-rw-r--r-- | test/test_process.py | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/test/test_process.py b/test/test_process.py index e62fce22..1bdb1400 100644 --- a/test/test_process.py +++ b/test/test_process.py @@ -292,23 +292,28 @@ class ProcessTest(CoverageTest): self.assertTrue("No module named no_such_module" in out) self.assertTrue("warning" not in out) - if sys.version_info >= (2, 7): # Need coverage runnable as a module. - def test_fullcoverage(self): - # fullcoverage is a trick to get stdlib modules measured from the - # very beginning of the process. Here we import os and then check - # how many lines are measured. - self.make_file("getenv.py", """\ - import os - print("FOOEY == %s" % os.getenv("FOOEY")) - """) - - fullcov = os.path.join(os.path.dirname(coverage.__file__), "fullcoverage") - self.set_environ("FOOEY", "BOO") - self.set_environ("PYTHONPATH", fullcov) - out = self.run_command("python -m coverage run -L getenv.py") - self.assertEqual(out, "FOOEY == BOO\n") - data = coverage.CoverageData() - data.read_file(".coverage") - # The actual number of lines in os.py executed when it is imported - # is 120 or so. Just running os.getenv executes about 5. - self.assertGreater(data.summary()['os.py'], 50) + if sys.version_info >= (3, 0): # This only works on 3.x for now. + # It only works with the C tracer. + if os.getenv('COVERAGE_TEST_TRACER', 'c') == 'c': + def test_fullcoverage(self): + # fullcoverage is a trick to get stdlib modules measured from + # the very beginning of the process. Here we import os and + # then check how many lines are measured. + self.make_file("getenv.py", """\ + import os + print("FOOEY == %s" % os.getenv("FOOEY")) + """) + + fullcov = os.path.join( + os.path.dirname(coverage.__file__), "fullcoverage" + ) + self.set_environ("FOOEY", "BOO") + self.set_environ("PYTHONPATH", fullcov) + out = self.run_command("python -m coverage run -L getenv.py") + self.assertEqual(out, "FOOEY == BOO\n") + data = coverage.CoverageData() + data.read_file(".coverage") + # The actual number of executed lines in os.py when it's + # imported is 120 or so. Just running os.getenv executes + # about 5. + self.assertGreater(data.summary()['os.py'], 50) |