Python3.10: TestConvert::test_no_file - AssertionError: 'optional arguments:' not found in 'usage: m2r.py
jsmolic opened this issue · comments
When runing tests with Python 3.10.0b1 I get the following test failure:
=========================================================== FAILURES ===========================================================
___________________________________________________ TestConvert.test_no_file ___________________________________________________
self = <tests.test_cli.TestConvert testMethod=test_no_file>
def test_no_file(self):
p = subprocess.Popen(
[sys.executable, '-m', 'm2r'],
stdout=subprocess.PIPE,
)
p.wait()
self.assertEqual(p.returncode, 0)
with p.stdout as buffer:
message = buffer.read().decode()
self.assertIn('usage', message)
self.assertIn('underscore-emphasis', message)
self.assertIn('anonymous-references', message)
self.assertIn('inline-math', message)
> self.assertIn('optional arguments:', message)
E AssertionError: 'optional arguments:' not found in 'usage: m2r.py [-h] [--overwrite] [--dry-run] [--no-underscore-emphasis] [--parse-relative-links] [--anonymous-references]\n [--disable-inline-math]\n [input_file ...]\n\npositional arguments:\n input_file files to convert to reST format\n\noptions:\n -h, --help show this help message and exit\n --overwrite overwrite output file without confirmaion\n --dry-run print conversion result and not save output file\n --no-underscore-emphasis\n do not use underscore (_) for emphasis\n --parse-relative-links\n parse relative links into ref or doc directives\n --anonymous-references\n use anonymous references in generated rst\n --disable-inline-math\n disable parsing inline math\n'
buffer = <_io.BufferedReader name=11>
message = ('usage: m2r.py [-h] [--overwrite] [--dry-run] [--no-underscore-emphasis] '
'[--parse-relative-links] [--anonymous-references]\n'
' [--disable-inline-math]\n'
' [input_file ...]\n'
'\n'
'positional arguments:\n'
' input_file files to convert to reST format\n'
'\n'
'options:\n'
' -h, --help show this help message and exit\n'
' --overwrite overwrite output file without confirmaion\n'
' --dry-run print conversion result and not save output file\n'
' --no-underscore-emphasis\n'
' do not use underscore (_) for emphasis\n'
' --parse-relative-links\n'
' parse relative links into ref or doc directives\n'
' --anonymous-references\n'
' use anonymous references in generated rst\n'
' --disable-inline-math\n'
' disable parsing inline math\n')
p = <Popen: returncode: 0 args: ['/usr/bin/python3.10', '-m', 'm2r']>
self = <tests.test_cli.TestConvert testMethod=test_no_file>
tests/test_cli.py:62: AssertionError
The possible fix in #62 works for me.