Working on a complex unittest that is testing a python UI, and a QT function appears to be suppressing test failures. I believe I've been able to create a minimal file that repeats the behavior:
import pytest
from unittest import TestCase
from PySide2.QtCore import QTimer
def meaningless():
return 'fire'
class TestClass(TestCase):
def test_1(self):
def inner_test_1():
self.assertEqual(meaningless(),'x')
inner_test_1()
def test_2(self):
def inner_test_2():
self.assertEqual(meaningless(),'x')
QTimer.singleShot(1, inner_test_2)
if __name__ == '__main__':
import sys
sys.exit(pytest.main([__file__]))
The first test fails as it should, but the second passes erroneously. In my more complex real-world unit test, the equivalent of "inner_test_2" does indeed fire, and the resulting assertion error can be seen in the test logs, but the test does not register as a failure. From what I can tell in the QT docs, this may have something to do with multi-threading? How do I get failures to fail?