TomographicImaging / CILViewer

A simple Viewer for 3D data built with VTK
Apache License 2.0
8 stars 6 forks source link

failing unit test: pytest and QApplication #367

Closed paskino closed 1 month ago

paskino commented 9 months ago

QApplication is a singleton and some unit tests fail with

RuntimeError: Please destroy the QApplication singleton before creating a new QApplication instance.

In particular this happens if one runs both test_viewer_main_windows.py and test_ui_dialogs.py

The following commands fails running the second test. The third command fails once the second of the 2 test files is run, i.e. generally test_viewer_main_windows.py

python -m pytest  test\test_viewer_main_windows.py test\test_ui_dialogs.py
python -m pytest  test\test_ui_dialogs.py test\test_viewer_main_windows.py
python -m pytest test
DanicaSTFC commented 2 months ago

All of the appearances of https://github.com/vais-ral/CILViewer/blob/471c82a81f3b95dd6f177a7890596d9c40f4df22/Wrappers/Python/test/test_viewer_main_windows.py#L67 will open a QApplication. Hence the line https://github.com/vais-ral/CILViewer/blob/471c82a81f3b95dd6f177a7890596d9c40f4df22/Wrappers/Python/test/test_viewer_main_windows.py#L42 is not compatible with it. This line should be removed. The checker for the instance class https://github.com/vais-ral/CILViewer/blob/471c82a81f3b95dd6f177a7890596d9c40f4df22/Wrappers/Python/test/test_viewer_main_windows.py#L41 does not work.