diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2010-06-23 22:30:35 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2010-06-23 22:30:35 -0400 |
commit | 4e6f9294d025b0b3102f27a217f6c6dac5d110a4 (patch) | |
tree | 6d177baf9afbbf3575a2a8dfda58866b9653501f /test | |
parent | 38d7d50b4815a4539829dee63fd79a617bf58f24 (diff) | |
download | python-coveragepy-git-4e6f9294d025b0b3102f27a217f6c6dac5d110a4.tar.gz |
Move the warnings to get them in more cases, and test one of those cases.
Diffstat (limited to 'test')
-rw-r--r-- | test/backtest.py | 2 | ||||
-rw-r--r-- | test/test_process.py | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/test/backtest.py b/test/backtest.py index 05a1e142..e8d8366d 100644 --- a/test/backtest.py +++ b/test/backtest.py @@ -18,6 +18,7 @@ except ImportError: """ _, stdouterr = os.popen4(cmd) return status, stdouterr.read() + else: def run_command(cmd, status=0): """Run a command in a subprocess. @@ -25,7 +26,6 @@ else: Returns the exit status code and the combined stdout and stderr. """ - proc = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT diff --git a/test/test_process.py b/test/test_process.py index d59d0726..684a5de0 100644 --- a/test/test_process.py +++ b/test/test_process.py @@ -243,3 +243,20 @@ class ProcessTest(CoverageTest): data = coverage.CoverageData() data.read_file(".coverage") self.assertEqual(data.summary()['fork.py'], 9) + + def test_warnings(self): + self.make_file("hello.py", """\ + import sys, os + print("Hello") + """) + out = self.run_command("coverage run --source=sys,xyzzy hello.py") + + # This output is not in the same order it appears in real command line + # output, but this is how it appears in the combined stdout/stderr that + # run_command gives us. + self.assertMultiLineEqual(out, textwrap.dedent("""\ + Hello + Coverage.py warning: Module sys has no python source. + Coverage.py warning: Source module xyzzy was never encountered. + Coverage.py warning: No data was collected. + """)) |