]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Closes issue 16064. No longer hard code executable name in unittest help output.
authorMichael Foord <michael@voidspace.org.uk>
Fri, 28 Sep 2012 14:14:37 +0000 (15:14 +0100)
committerMichael Foord <michael@voidspace.org.uk>
Fri, 28 Sep 2012 14:14:37 +0000 (15:14 +0100)
Lib/unittest/__main__.py
Misc/NEWS

index 7320050ae954cc3037760f8470c91fbad7301280..798ebc0f5302e15e9ababb75ec527b0725cdd937 100644 (file)
@@ -2,7 +2,14 @@
 
 import sys
 if sys.argv[0].endswith("__main__.py"):
-    sys.argv[0] = "python -m unittest"
+    import os.path
+    # We change sys.argv[0] to make help message more useful
+    # use executable without path, unquoted
+    # (it's just a hint anyway)
+    # (if you have spaces in your executable you get what you deserve!)
+    executable = os.path.basename(sys.executable)
+    sys.argv[0] = executable + " -m unittest"
+    del os
 
 __unittest = True
 
index 33ea2669341be9353fa00eaac52ec568a7262556..fe0be74203008369a3bd3eda1897184895c3da52 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -36,6 +36,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #16064: unittest -m claims executable is "python", not "python3"
+
 - Issue #15222: Insert blank line after each message in mbox mailboxes
 
 - Issue #16013: Fix CSV Reader parsing issue with ending quote characters.