Xqt created this task.
Xqt added projects: Pywikibot, Pywikibot-tests.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.
TASK DESCRIPTION
_____________________________ TestPwb.test_unicode
_____________________________
self = <tests.pwb_tests.TestPwb testMethod=test_unicode>
def test_unicode(self) -> None:
"""Test printing unicode in pywikibot."""
(direct, vpwb) = self._do_check('print_unicode')
self.assertEqual('Häuser', direct['stdout'].strip())
self.assertEqual('Häuser', direct['stderr'].strip())
self.assertEqual('Häuser', vpwb['stdout'].strip())
> self.assertEqual('Häuser', vpwb['stderr'].strip())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
def test_argv(self) -> None:
"""Test argv of pywikibot.
Make sure that argv passed to the script is not contaminated by
global options given to pwb.py wrapper.
"""
script_name = 'print_argv'
script_path = join_pwb_tests_path(script_name + '.py')
script_opts = ['-help']
command = [script_path, *script_opts]
without_global_args = execute_pwb(command)
with_no_global_args = execute_pwb(['-maxlag:5', *command])
self.assertEqual(without_global_args['stdout'],
with_no_global_args['stdout'])
self.assertEqual(without_global_args['stdout'].rstrip(),
str([script_name, *script_opts]))
def test_script_found(self) -> None:
"""Test pwb.py script call which is found."""
stdout = io.StringIO(execute_pwb(['pwb'])['stdout'])
self.assertEqual(stdout.readline().strip(),
'Wrapper script to invoke pywikibot-based
scripts.')
@unittest.skipIf(python_implementation() == 'GraalVM',
reason='T413711')
def test_script_not_found(self) -> None:
"""Test pwbot.py script call which is not found."""
stderr = io.StringIO(execute_pwb(['pywikibot'])['stderr'])
self.assertEqual(stderr.readline().strip(),
'ERROR: pywikibot.py not found! Misspelling?')
@unittest.skipIf(python_implementation() == 'GraalVM',
reason='T413711')
def test_one_similar_script(self) -> None:
"""Test shell.py script call which gives one similar result."""
result = [
'ERROR: hello.py not found! Misspelling?',
'NOTE: Starting the most similar script shell.py',
'in 5.0 seconds; type CTRL-C to stop.',
]
stream = execute_pwb(['hello'], data_in=chr(3), timeout=12)
stderr = io.StringIO(stream['stderr'])
with self.subTest(line=0):
self.assertEqual(stderr.readline().strip(), result[0])
with self.subTest(line=1):
text = stderr.readline().strip()
self.assertTrue(
text.startswith(result[1]),
msg=f'"{text}" does not start with "{result[1]}"')
with self.subTest(line=2):
self.assertEqual(stderr.readline().strip(), result[2])
@unittest.skipIf(python_implementation() == 'GraalVM',
reason='T413711')
def test_similar_scripts_found(self) -> None:
"""Test script call which gives multiple similar results."""
result = [
'ERROR: inter_wikidata.py not found! Misspelling?',
'',
'The most similar scripts are:',
'1 - interwikidata',
'2 - interwiki',
'3 - illustrate_wikidata',
]
stderr = io.StringIO(
execute_pwb(['inter_wikidata'], data_in='q')['stderr'])
for line in result:
with self.subTest(line=line):
self.assertEqual(stderr.readline().strip(), line)
remaining = stderr.readlines()
self.assertLength(remaining, 3) # always 3 lines remaining
after list
if __name__ == '__main__':
E AssertionError: 'Häuser' != "[To redirect Truffle log output to a
fil[724 chars]user"
E - Häuser
E + [To redirect Truffle log output to a file use one of the following
options:
E * '--log.file=<path>' if the option is passed using a guest language
launcher.
E * '-Dpolyglot.log.file=<path>' if the option is passed using the host
Java launcher.
E * Configure logging using the polyglot embedding API.]
E Warning: Systemic Graal compilation failure detected: 1 of 42 (2%) of
compilations failed during last 0 ms [max rate set by
SystemicCompilationFailureRate is 1%]. To mitigate systemic compilation failure
detection, set SystemicCompilationFailureRate to a higher value. To disable
systemic compilation failure detection, set SystemicCompilationFailureRate to
0. To get more information on compilation failures, set
CompilationFailureAction to Print or Diagnose.
E Häuser
tests/pwb_tests.py:77: AssertionError
TASK DETAIL
https://phabricator.wikimedia.org/T434391
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
_______________________________________________
pywikibot-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]