-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into perf_resize_text
- Loading branch information
Showing
8 changed files
with
123 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,3 +56,4 @@ Related Projects | |
widgets.rst | ||
plugins.rst | ||
utils.rst | ||
unit_tests.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
################ | ||
Unit Test Quirks | ||
################ | ||
|
||
Typhos, from time to time, has had issues with its unit tests. | ||
These often manifest as test failures and segmentation faults that only occur | ||
when running the tests on a cloud platform. | ||
|
||
By and large, these are related to difficulty with cleaning up resources from | ||
tests that allocate qt widgets. | ||
|
||
|
||
Things to Know for Test Writers | ||
------------------------------- | ||
|
||
- Always use the ``qtbot`` fixture (from the ``pytest-qt`` package) | ||
- Always call ``qtbot.add_widget(widget)`` on any widget you create in your test. | ||
This helps clean up your widget after the test is complete. | ||
- Use the ``qapp`` fixture and call ``qapp.processEvents()`` if you need "something" | ||
in the qt world to happen. | ||
- Use the ``noapp`` fixture if you need to test code that calls ``qapp.exec_()`` or | ||
``qapp.exit()``. Calling this code with no fixture will break the test suite for | ||
all future tests than need the ``qapp``. | ||
- If your test is segfaulting, try using the ``@pytest.mark.no_gc`` decorator | ||
to skip the manual garbage collection step from the ``pytest_runtest_call`` hook | ||
in ``conftest.py``. In some cases (e.g. the positioner widgets) this is an ill-timed | ||
redundant call. | ||
- If an external package's widgets (and none of ours) are showing up in the | ||
widget cleanup check (also in the ``pytest_runtest_call`` hook), try using | ||
the ``@pytest.mark.no_cleanup_check`` decorator. If these come from ``typhos`` | ||
it's fairly important to fix the issue, but if they come from an external | ||
package it's hard to do something about it. | ||
|
||
|
||
Local vs Cloud | ||
-------------- | ||
|
||
There are a few major differences between local and cloud builds, even | ||
on the same architecture: | ||
|
||
- Cloud builds set the environment variable for offscreen rendering (no rendering). | ||
This slightly changes the timing and drastically changes the implementation of | ||
the qt drawing primitives. You can set this yourself locally via | ||
``export QT_QPA_PLUGIN=offscreen``. | ||
- Cloud builds use the latest versions of packages, which may differ from the ones | ||
you have installed locally. | ||
- Ideally, the test suite should pass both on local hardware with the default | ||
qpa plugin and also on the cloud. |
22 changes: 22 additions & 0 deletions
22
docs/source/upcoming_release_notes/607-tst_fix_ci_saga.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
607 tst_fix_ci_saga | ||
################### | ||
|
||
API Breaks | ||
---------- | ||
- N/A | ||
|
||
Features | ||
-------- | ||
- N/A | ||
|
||
Bugfixes | ||
-------- | ||
- N/A | ||
|
||
Maintenance | ||
----------- | ||
- Fix issues with cloud-only CI failures and segfaults. | ||
|
||
Contributors | ||
------------ | ||
- zllentz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[pytest] | ||
filterwarnings= default | ||
once::DeprecationWarning | ||
filterwarnings = default | ||
once::DeprecationWarning | ||
addopts = --benchmark-skip | ||
markers = no_gc: mark a test as unstable with the per-test gc | ||
no_cleanup_check: mark a test to skip the widget cleanup assert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters