diff --git a/pydm/tests/test_main_window.py b/pydm/tests/test_main_window.py index b1c46b6aa..a0d537745 100644 --- a/pydm/tests/test_main_window.py +++ b/pydm/tests/test_main_window.py @@ -1,6 +1,7 @@ import os -from pydm import Display, PyDMApplication +from pydm import PyDMApplication +from pydm.display import Display, clear_compiled_ui_file_cache from qtpy import uic from unittest.mock import MagicMock, patch @@ -11,14 +12,19 @@ @patch("qtpy.uic.compileUi", wraps=uic.compileUi) def test_reload_display(wrapped_compile_ui: MagicMock, qapp: PyDMApplication) -> None: """Verify that when a user reloads a PyDM window the underling display's ui file is actually reloaded""" - display = Display(parent=None, ui_filename=test_ui_path) + clear_compiled_ui_file_cache() # Ensure other tests have not already compiled our test file before we start - qapp.make_main_window() - qapp.main_window.set_display_widget(display) + try: + display = Display(parent=None, ui_filename=test_ui_path) - # When the display is first created and loaded the underlying ui file gets compiled - wrapped_compile_ui.assert_called_once() + qapp.make_main_window() + qapp.main_window.set_display_widget(display) - # Reloading should force a re-compile of the ui file to ensure any changes are picked up - qapp.main_window.reload_display(True) - assert wrapped_compile_ui.call_count == 2 + # When the display is first created and loaded the underlying ui file gets compiled + wrapped_compile_ui.assert_called_once() + + # Reloading should force a re-compile of the ui file to ensure any changes are picked up + qapp.main_window.reload_display(True) + assert wrapped_compile_ui.call_count == 2 + finally: + clear_compiled_ui_file_cache()