Skip to content

Commit

Permalink
test_qaction_set_menu: Fix test with
Browse files Browse the repository at this point in the history
  • Loading branch information
ales-erjavec committed May 24, 2024
1 parent 8d59fcc commit bcaeafa
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tests/test_qaction_set_menu.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import unittest

from AnyQt.QtTest import QSignalSpy
from weakref import ref

from AnyQt.QtWidgets import QMenu, QApplication
from AnyQt.QtGui import QAction
from AnyQt.QtCore import delete


class TestQAction_setMenu(unittest.TestCase):
Expand All @@ -23,12 +23,11 @@ def tearDownClass(cls) -> None:
def test(self):
ac = QAction()
menu = QMenu()
wref = ref(menu)
ac.setMenu(menu)
self.assertIs(ac.menu(), menu)
ac.setMenu(None)
self.assertIs(ac.menu(), None)
spy = QSignalSpy(menu.destroyed)
delete(menu)
menu.setParent(None) # parent is None but without this PySide2 fails??
del menu
self.assertEqual(len(spy), 1)

self.assertIsNone(wref())

0 comments on commit bcaeafa

Please sign in to comment.