From f08cf696283f8c55451afa4046ca777bcfd90436 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 24 Nov 2012 17:20:30 -0500 Subject: 'coverage debug sys' shows the python executable, and there's a test that our subprocesses use the same one we do. --- test/test_testing.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/test_testing.py') diff --git a/test/test_testing.py b/test/test_testing.py index 9943b65c..1ea3232f 100644 --- a/test/test_testing.py +++ b/test/test_testing.py @@ -167,3 +167,20 @@ class CoverageTestTest(CoverageTest): AssertionError, self.assert_doesnt_exist, "whoville.txt" ) self.assertRaises(AssertionError, self.assert_exists, "shadow.txt") + + def test_sub_python_is_this_python(self): + # Try it with a python command. + self.make_file("showme.py", """\ + import os, sys + print(sys.executable) + print(os.__file__) + """) + out = self.run_command("python showme.py").splitlines() + self.assertEqual(out[0], sys.executable) + self.assertEqual(out[1], os.__file__) + + # Try it with a "coverage debug sys" command. + out = self.run_command("coverage debug sys").splitlines() + executable = [l for l in out if "executable:" in l][0] + executable = executable.split(":", 1)[1].strip() + self.assertEqual(executable, sys.executable) -- cgit v1.2.1