You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The unit tests in the Config class in wormhole.test.test_args fail in Windows 10 when running all tests (i.e. python -m wormhole.test.run_trial wormhole) but succeed when running only the tests in test_args (as in python -m wormhole.test.run_trial wormhole.test.test_args).
Failing output:
...
test_write_when_closing ... [OK]
wormhole.test.test_args
Config
test_receive ... [FAIL]
test_send ... [FAIL]
Receive
test_accept_file ... [OK]
test_appid ... [OK]
...
[lots of tests]
...
===============================================================================
[FAIL]
Traceback (most recent call last):
File "c:\users\user\repo\magic-wormhole\src\wormhole\test\test_args.py", line 202, in test_receive
self.assertEqual(cfg.stdout, sys.stdout)
File "C:\Users\user\repo\magic-wormhole\.tox\py38\lib\site-packages\twisted\trial\_synctest.py", line 424, in assertEqual
super().assertEqual(first, second, msg)
File "C:\Python38\lib\unittest\case.py", line 912, in assertEqual
assertion_func(first, second, msg=msg)
File "C:\Python38\lib\unittest\case.py", line 905, in _baseAssertEqual
raise self.failureException(msg)
twisted.trial.unittest.FailTest: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>!= <colorama.ansitowin32.StreamWrapper object at 0x0000020D534E4EB0>
wormhole.test.test_args.Config.test_receive
===============================================================================
[FAIL]
Traceback (most recent call last):
File "c:\users\user\repo\magic-wormhole\src\wormhole\test\test_args.py", line 198, in test_send
self.assertEqual(cfg.stdout, sys.stdout)
File "C:\Users\user\repo\magic-wormhole\.tox\py38\lib\site-packages\twisted\trial\_synctest.py", line 424, in assertEqual
super().assertEqual(first, second, msg)
File "C:\Python38\lib\unittest\case.py", line 912, in assertEqual
assertion_func(first, second, msg=msg)
File "C:\Python38\lib\unittest\case.py", line 905, in _baseAssertEqual
raise self.failureException(msg)
twisted.trial.unittest.FailTest: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>!= <colorama.ansitowin32.StreamWrapper object at 0x0000020D534E4EB0>
wormhole.test.test_args.Config.test_send
-------------------------------------------------------------------------------
Ran 449 tests in 62.482s
FAILED (skips=1, expectedFailures=1, failures=2, successes=445)
ERROR: InvocationError forcommand'C:\Users\user\repo\magic-wormhole\.tox\py38\Scripts\python.EXE' -m wormhole.test.run_trial wormhole (exited with code 1)
____________________________________________ summary _____________________________________________ ERROR: py38: commands failed
This bizarre problem appears to be caused by colorama being loaded in some different set of tests and colorama.init() executed, changing the value of sys.stdout from the default <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'> to a colorama.ansitowin32.StreamWrapper, a state that persists as long as the interpreter is running. Presumably, colorama is being loaded by click which has it among its dependencies.
I'd be happy to address this myself, but I'm not sure what the actual desired behaviour of these tests are. Perhaps the point is to check that the click app writes output to the calling shell's stdout? Are we happy to just check the filenos are the same?
The text was updated successfully, but these errors were encountered:
I think those two tests are essentially just testing "test helper" code (i.e. that it ... doesn't override stdin/stdout as a result of that helper call?)
The unit tests in the
Config
class inwormhole.test.test_args
fail in Windows 10 when running all tests (i.e.python -m wormhole.test.run_trial wormhole
) but succeed when running only the tests intest_args
(as inpython -m wormhole.test.run_trial wormhole.test.test_args
).Failing output:
This bizarre problem appears to be caused by
colorama
being loaded in some different set of tests andcolorama.init()
executed, changing the value ofsys.stdout
from the default<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
to acolorama.ansitowin32.StreamWrapper
, a state that persists as long as the interpreter is running. Presumably,colorama
is being loaded byclick
which has it among its dependencies.I'd be happy to address this myself, but I'm not sure what the actual desired behaviour of these tests are. Perhaps the point is to check that the click app writes output to the calling shell's stdout? Are we happy to just check the
fileno
s are the same?The text was updated successfully, but these errors were encountered: