Commits

Ned Batchelder  committed d5d1d97

'coverage debug sys' shows the python executable, and there's a test that our subprocesses use the same one we do.

  • Participants
  • Parent commits d44b8d0

Comments (0)

Files changed (2)

File coverage/control.py

             ('python', sys.version.replace('\n', '')),
             ('platform', platform.platform()),
             ('implementation', implementation),
+            ('executable', sys.executable),
             ('cwd', os.getcwd()),
             ('path', sys.path),
             ('environment', [

File test/test_testing.py

             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)