enthought / enthought/pyface

Test interactions in pyqt test suite

Open
#516 5 comments 0 reactions 0 assignees View on GitHub
component: test suite
Dominant language
Python
Stars
115
Forks
54
PR merge metrics
No merged PRs in 30d

Description

While working on unittest runner I discovered that the `pyqt` test suite is being much slower and 4 timer tests are failing due to time-outs (see below for test errors). This does not happen with nose or haas test runners because they run tests in `pyface/tests` **after** `pyface/timer/tests` and `pyface/ui/qt`. The change in behaviour based on the order of the tests suggests test interactions.

I have checked for `QObject` leakage - there is some, but it doesn't seem to be the cause of the slowdown. The slowdown seems to be related to the event loop -- the problem can be "fixed" by skipping tests in `test_gui_application` and tests that use `ModalDialogTester`, or by running them at the end of the `pyqt` test suite.

Note: the slowdown also doesn't happen if the test suite is run in the foreground.

Test Errors

```
======================================================================
ERROR: test_interval (pyface.timer.tests.test_timer.TestCallbackTimer)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/icernyte/Documents/repos/pyface/pyface/timer/tests/test_timer.py", line 292, in test_interval
lambda: not timer.active

File "/Users/icernyte/Documents/repos/pyface/pyface/ui/qt4/util/event_loop_helper.py", line 133, in event_loop_until_condition
"Timed out waiting for condition"
pyface.ui.qt4.util.event_loop_helper.ConditionTimeoutError: Timed out waiting for condition

======================================================================
ERROR: test_repeat (pyface.timer.tests.test_timer.TestCallbackTimer)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/icernyte/Documents/repos/pyface/pyface/timer/tests/test_timer.py", line 276, in test_repeat
lambda: not timer.active
File "/Users/icernyte/Documents/repos/pyface/pyface/ui/qt4/util/event_loop_helper.py", line 133, in event_loop_until_condition
"Timed out waiting for condition"
pyface.ui.qt4.util.event_loop_helper.ConditionTimeoutError: Timed out waiting for condition

======================================================================
ERROR: test_interval (pyface.timer.tests.test_timer.TestEventTimer)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/icernyte/Documents/repos/pyface/pyface/timer/tests/test_timer.py", line 139, in test_interval
lambda: not timer.active
File "/Users/icernyte/Documents/repos/pyface/pyface/ui/qt4/util/event_loop_helper.py", line 133, in event_loop_until_condition
"Timed out waiting for condition"
pyface.ui.qt4.util.event_loop_helper.ConditionTimeoutError: Timed out waiting for condition

======================================================================
ERROR: test_repeat (pyface.timer.tests.test_timer.TestEventTimer)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/icernyte/Documents/repos/pyface/pyface/timer/tests/test_timer.py", line 124, in test_repeat
lambda: not timer.active
File "/Users/icernyte/Documents/repos/pyface/pyface/ui/qt4/util/event_loop_helper.py", line 133, in event_loop_until_condition
"Timed out waiting for condition"
pyface.ui.qt4.util.event_loop_helper.ConditionTimeoutError: Timed out waiting for condition

----------------------------------------------------------------------
Ran 574 tests in 368.345s

FAILED (errors=4, skipped=19)
Command '['/Users/icernyte/.edm/envs/dev-general/bin/edm', 'run', '-e', 'pyface-test-3.6-pyqt', '--', 'coverage', 'run', '-p', '-m', 'unittest', 'discover', '-v', 'pyface']' returned non-zero exit status 1.
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.