From d38e6e516de30158e4bb4e32961c3889f2f69339 Mon Sep 17 00:00:00 2001 From: Michael Foord Date: Fri, 28 Sep 2012 15:14:37 +0100 Subject: Closes issue 16064. No longer hard code executable name in unittest help output. --- Lib/unittest/__main__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Lib/unittest') diff --git a/Lib/unittest/__main__.py b/Lib/unittest/__main__.py index 7320050ae9..798ebc0f53 100644 --- a/Lib/unittest/__main__.py +++ b/Lib/unittest/__main__.py @@ -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 -- cgit v1.2.1