Skip to content

Commit

Permalink
test_owcsvimport: Remove create_widget override
Browse files Browse the repository at this point in the history
Avoid possible double memory reclamation
  • Loading branch information
ales-erjavec committed Feb 15, 2024
1 parent ddbc612 commit ddfc4d3
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions Orange/widgets/data/tests/test_owcsvimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,6 @@


class TestOWCSVFileImport(WidgetTest):
def create_widget(
self, cls: Type[W], stored_settings: Optional[dict] = None,
reset_default_settings=True, **kwargs) -> W:
if reset_default_settings:
self.reset_default_settings(cls)
widget = cls.__new__(cls, signal_manager=self.signal_manager,
stored_settings=stored_settings, **kwargs)
widget.__init__()

def delete():
widget.onDeleteWidget()
widget.close()
widget.deleteLater()

self._stack.callback(delete)
return widget

def setUp(self):
super().setUp()
self._stack = ExitStack().__enter__()
Expand Down Expand Up @@ -293,6 +276,7 @@ def test_browse_for_missing(self):
widget.activate_recent(0)
dlg = widget.findChild(QFileDialog)
assert dlg is not None
dlg.setParent(None)
# calling selectFile when using native (macOS) dialog does not have
# an effect - at least not immediately;
dlg.setOption(QFileDialog.DontUseNativeDialog)
Expand All @@ -303,6 +287,7 @@ def test_browse_for_missing(self):
self.assertEqual(
self.data_regions_options.as_dict(), cur.options().as_dict()
)
dlg.deleteLater()

def test_browse_for_missing_prefixed(self):
path = self.data_regions_path
Expand Down Expand Up @@ -349,6 +334,7 @@ def test_browse_for_missing_prefixed_parent(self):
widget.activate_recent(0)
dlg = widget.findChild(QFileDialog)
assert dlg is not None
dlg.setParent(None)
# calling selectFile when using native (macOS) dialog does not have
# an effect - at least not immediately;
dlg.setOption(QFileDialog.DontUseNativeDialog)
Expand All @@ -358,6 +344,7 @@ def test_browse_for_missing_prefixed_parent(self):
cur = widget.current_item()
self.assertEqual(item[0], cur.varPath())
self.assertEqual(item[1].as_dict(), cur.options().as_dict())
dlg.deleteLater()


class TestImportDialog(GuiTest):
Expand Down

0 comments on commit ddfc4d3

Please sign in to comment.