beeware / voc

A transpiler that converts Python code into Java bytecode
http://beeware.org/voc
BSD 3-Clause "New" or "Revised" License
869 stars 518 forks source link

unittest test_simple_generator failure #990

Open jayvdb opened 4 years ago

jayvdb commented 4 years ago

On voc 0.1.6, on openSUSE Leap_15.1 (py36) I am seeing the following test failure when the test suite is invoked using setup.py test.

I am not running the tests on openSUSE Tumbleweed (py37) because of lots of little predictable test failures reported as https://github.com/beeware/voc/issues/985

This looks like a stdio stream merging/flushing problem, with "finally" appearing in the wrong position.

[ 5365s] FAIL: test_simple_generator (tests.structures.test_generator.GeneratorTests)
[ 5365s] ----------------------------------------------------------------------
[ 5365s] Traceback (most recent call last):
[ 5365s]   File "/home/abuild/rpmbuild/BUILD/voc-0.1.6/tests/structures/test_generator.py", line 20, in test_simple_generator
[ 5365s]     """)
[ 5365s]   File "/home/abuild/rpmbuild/BUILD/voc-0.1.6/tests/utils.py", line 465, in assertCodeExecution
[ 5365s]     self.assertEqual(java_out, py_out, context)
[ 5365s] AssertionError: 'finally\n[20, 400, 8000, 160000]\n===end of test===\n' != '[20, 400, 8000, 160000]\n===end of test===\n'
[ 5365s] - finally
[ 5365s]   [20, 400, 8000, 160000]
[ 5365s]   ===end of test===
[ 5365s]  : Function context

I'm re-running the tests using pytest, at https://build.opensuse.org/package/show/home:jayvdb:py-new/python-voc , but that will take a while to complete.

It would be great to have a patch to add to 0.1.6 to fix this test failure, or removal of the test_suite in setup.py to indicate that setup.py test is no longer supported.

There hasnt been any changes at https://github.com/beeware/voc/blame/master/tests/structures/test_generator.py since the last release, but maybe there are other merged changes which might fix this.

jayvdb commented 4 years ago

Confirmed the test passes when using pytest instead of unittest.