GeezerVison is showing github.com — [3.15] gh-157159: improve the tabnanny usage message (GH-157160) (#15… · python/cpython@cf312cf
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: Lib/tabnanny.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -47,7 +47,7 @@ def main(): |
47 | 47 | if o == '-v': |
48 | 48 | verbose = verbose + 1 |
49 | 49 | if not args: |
50 | | - errprint("Usage:", sys.argv[0], "[-v] file_or_directory ...") |
| 50 | + errprint(f"Usage: {sys.executable} -m tabnanny [-v] file_or_directory ...") |
51 | 51 | for arg in args: |
52 | 52 | check(arg) |
53 | 53 |
|
|
Collapse file
Copy file name to clipboardExpand all lines: Lib/test/test_tabnanny.py +3-4Lines changed: 3 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
7 | 7 | from unittest import TestCase, main, mock |
8 | 8 | import errno |
9 | 9 | import os |
| 10 | +import sys |
10 | 11 | import tabnanny |
11 | 12 | import tokenize |
12 | 13 | import tempfile |
13 | 14 | import textwrap |
14 | | -from test.support import (captured_stderr, captured_stdout, script_helper, |
15 | | - findfile) |
| 15 | +from test.support import captured_stderr, captured_stdout, script_helper |
16 | 16 | from test.support.os_helper import unlink |
17 | 17 |
|
18 | 18 |
|
@@ -328,8 +328,7 @@ def test_with_error_free_file(self): |
328 | 328 |
|
329 | 329 | def test_command_usage(self): |
330 | 330 | """Should display usage on no arguments.""" |
331 | | - path = findfile('tabnanny.py') |
332 | | - stderr = f"Usage: {path} [-v] file_or_directory ..." |
| 331 | + stderr = f"Usage: {sys.executable} -m tabnanny [-v] file_or_directory ..." |
333 | 332 | self.validate_cmd(stderr=stderr, expect_failure=True) |
334 | 333 |
|
335 | 334 | def test_quiet_flag(self): |
|
Collapse file
Copy file name to clipboard +2Lines changed: 2 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +The usage message printed by ``python -m tabnanny`` when no arguments are |
| 2 | +given now suggests ``python -m`` instead of the source file. |