[issue41731] test_cmd_line_script fails with verbosity level more than 1

Terry J. Reedy report at bugs.python.org
Fri Sep 11 19:05:18 EDT 2020


Terry J. Reedy <tjreedy at udel.edu> added the comment:

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.

----------
nosy: +terry.reedy

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41731>
_______________________________________


More information about the Python-bugs-list mailing list