-
-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test_cmd_line_script fails with verbosity level more than 1 #85897
Comments
When verbosity level is more than 1 the test tries to print the script_exec_args passed to script. It fails when the tuple has more than 1 elements and is used in formatting with %r. The two tests fail as below : ./python -m test test_cmd_line_script -vv ====================================================================== Traceback (most recent call last):
File "/root/cpython/Lib/test/test_cmd_line_script.py", line 368, in test_package_error
self._check_import_error(["-m", "test_pkg"], msg, cwd=script_dir)
File "/root/cpython/Lib/test/test_cmd_line_script.py", line 148, in _check_import_error
print('Output from test script %r:' % script_exec_args)
TypeError: not all arguments converted during string formatting ====================================================================== Traceback (most recent call last):
File "/root/cpython/Lib/test/test_cmd_line_script.py", line 379, in test_package_recursion
self._check_import_error(["-m", "test_pkg"], msg, cwd=script_dir)
File "/root/cpython/Lib/test/test_cmd_line_script.py", line 148, in _check_import_error
print('Output from test script %r:' % script_exec_args)
TypeError: not all arguments converted during string formatting Ran 44 tests in 4.936s FAILED (errors=2) == Tests result: FAILURE == 1 test failed: Total duration: 5.0 sec |
I verified with master on Win10 debug 32 build. The relevant lines, 147-151, are if verbose > 1:
print('Output from test script %r:' % script_exec_args)
print(repr(err))
print('Expected output: %r' % expected_msg)
self.assertIn(expected_msg.encode('utf-8'), err) Normally, 'script_exec_args' is singular, the absolute file name to be executed. In the two failing cases, file 'name' is an import name, preceded by -m. Line 148 prints an informational header, when very verbose is requested, that only serves to identify the following lines. It is *not* tested. Therefore, we need not worry about the exact format, just avoiding a spurious error. The following is equivalent except when the value is a list (which should have been a tuple), when is prints without error: print(f'Output from test script {script_exec_args!r:}') "Output from test script ['-m', 'test_pkg']:" seems clear enough for any human reader. I ran entire suite with -vv and did not find any other new, unexpected errors. PR to follow shortly. |
Thanks Terry. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: