Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d38e6e5

Browse files
committed
Closes issue 16064. No longer hard code executable name in unittest help output.
1 parent 0e1af28 commit d38e6e5

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

Lib/unittest/__main__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22

33
import sys
44
if sys.argv[0].endswith("__main__.py"):
5-
sys.argv[0] = "python -m unittest"
5+
import os.path
6+
# We change sys.argv[0] to make help message more useful
7+
# use executable without path, unquoted
8+
# (it's just a hint anyway)
9+
# (if you have spaces in your executable you get what you deserve!)
10+
executable = os.path.basename(sys.executable)
11+
sys.argv[0] = executable + " -m unittest"
12+
del os
613

714
__unittest = True
815

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ Core and Builtins
3636
Library
3737
-------
3838

39+
- Issue #16064: unittest -m claims executable is "python", not "python3"
40+
3941
- Issue #15222: Insert blank line after each message in mbox mailboxes
4042

4143
- Issue #16013: Fix CSV Reader parsing issue with ending quote characters.

0 commit comments

Comments
 (0)