Skip to content

Commit

Permalink
rev base teardown
Browse files Browse the repository at this point in the history
  • Loading branch information
ales-erjavec committed Mar 8, 2024
1 parent b8fe27f commit 7141001
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
10 changes: 1 addition & 9 deletions Orange/widgets/data/utils/pythoneditor/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
as published by the Free Software Foundation, version 2.1 of the license.
This is compatible with Orange3's GPL-3.0 license.
""" # pylint: disable=duplicate-code
import gc

from AnyQt.QtGui import QKeySequence
from AnyQt.QtTest import QTest
from AnyQt.QtCore import Qt, delete
from AnyQt.QtCore import Qt

from orangewidget.utils import enum_as_int

Expand All @@ -27,13 +25,7 @@ def setUp(self) -> None:

def tearDown(self) -> None:
self.qpart.terminate()
# QTextEdit.ExtraSelection instances still remain ref cycles.
# They need to be released before the editor widget as they
# contain text cursors with C pointers to the widget's contents
gc.collect()
delete(self.qpart)
del self.qpart
gc.collect()
super().tearDown()


Expand Down
5 changes: 1 addition & 4 deletions Orange/widgets/data/utils/pythoneditor/tests/test_vim.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,8 @@ def setUp(self):

def tearDown(self):
self.qpart.hide()
self.qpart.vimModeIndicationChanged.disconnect(self._onVimModeChanged)
super().tearDown()
insta = [o for o in gc.get_objects() if isinstance(o, QTextEdit.ExtraSelection)]
print(insta, flush=True)
if insta:
raise RuntimeError("ExtraSelection survives")

def _onVimModeChanged(self, _, mode):
self.vimMode = mode
Expand Down

0 comments on commit 7141001

Please sign in to comment.