Skip to content

Commit

Permalink
Comment out tearDown()
Browse files Browse the repository at this point in the history
  • Loading branch information
soininen committed Sep 11, 2023
1 parent 7a62249 commit 84be2c9
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions tests/test_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,11 @@ class TestBase(unittest.TestCase):
@classmethod
def setUpClass(cls):
print("Do we even get here?")
time.sleep(1)
if not QApplication.instance():
QApplication()

def setUp(self):
print("*** setUp() start ***")
time.sleep(1)
with patch("spinetoolbox.spine_db_editor.widgets.spine_db_editor.SpineDBEditor.restore_ui"), patch(
"spinetoolbox.spine_db_editor.widgets.spine_db_editor.SpineDBEditor.show"
):
Expand All @@ -69,23 +67,22 @@ def setUp(self):
self._db_mngr = TestSpineDBManager(mock_settings, None)
logger = MagicMock()
self._db_map = self._db_mngr.get_db_map("sqlite://", logger, codename="test database", create=True)
#self._db_editor = SpineDBEditor(self._db_mngr, {"sqlite://": "test database"})
self._db_editor = MagicMock()
self._db_editor = SpineDBEditor(self._db_mngr, {"sqlite://": "test database"})
print("*** setUp() end ***")

def tearDown(self):
with patch("spinetoolbox.spine_db_editor.widgets.spine_db_editor.QMessageBox") as message_box:
message_box.exec.return_value = QMessageBox.StandardButton.Ok
self._db_editor.rollback_session()
with patch("spinetoolbox.spine_db_editor.widgets.spine_db_editor.SpineDBEditor.save_window_state"), patch(
"spinetoolbox.spine_db_manager.QMessageBox"
):
self._db_editor.close()
while not self._db_map.closed:
QApplication.processEvents()
self._db_mngr.clean_up()
self._db_editor.deleteLater()
self._db_editor = None
# def tearDown(self):
# with patch("spinetoolbox.spine_db_editor.widgets.spine_db_editor.QMessageBox") as message_box:
# message_box.exec.return_value = QMessageBox.StandardButton.Ok
# self._db_editor.rollback_session()
# with patch("spinetoolbox.spine_db_editor.widgets.spine_db_editor.SpineDBEditor.save_window_state"), patch(
# "spinetoolbox.spine_db_manager.QMessageBox"
# ):
# self._db_editor.close()
# while not self._db_map.closed:
# QApplication.processEvents()
# self._db_mngr.clean_up()
# self._db_editor.deleteLater()
# self._db_editor = None

def _add_entity_parameter_values(self, values):
self._db_mngr.add_entity_classes({self._db_map: [{"name": "class", "id": 1}]})
Expand Down

0 comments on commit 84be2c9

Please sign in to comment.