Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
6.5.1
-
None
Description
Code (test_bug.py):
from PySide6.QtCore import QObject, QTimer from pytestqt.qtbot import QtBot MS = 10 class MyObject(QObject): def fun(self, value: int) -> None: self.value = value QTimer.singleShot(MS, lambda: print(f"({self.value}, {value}); ", end="")) def test_bug(qtbot: QtBot) -> None: my_object = MyObject() for i in range(10): my_object.fun(i) qtbot.wait(2 * MS)
Command line:
pytest test_bug.py -s
Output with 6.5.0 (correct):
======================================================================================== test session starts ========================================================================================= platform win32 -- Python 3.11.3, pytest-7.3.1, pluggy-1.0.0 PySide6 6.5.0 -- Qt runtime 6.5.0 -- Qt compiled 6.5.0 rootdir: C:\Code plugins: pylama-8.4.1, qt-4.2.0 collected 1 item test_bug.py (0, 0); (1, 1); (2, 2); (3, 3); (4, 4); (5, 5); (6, 6); (7, 7); (8, 8); (9, 9); . ========================================================================================= 1 passed in 0.26s ==========================================================================================
Output with 6.5.1 (wrong, I would say):
======================================================================================== test session starts ========================================================================================= platform win32 -- Python 3.11.3, pytest-7.3.1, pluggy-1.0.0 PySide6 6.5.1 -- Qt runtime 6.5.1 -- Qt compiled 6.5.1 rootdir: C:\Code plugins: pylama-8.4.1, qt-4.2.0 collected 1 item test_bug.py (0, 0); (1, 0); (2, 0); (3, 0); (4, 0); (5, 0); (6, 0); (7, 0); (8, 0); (9, 0); . ========================================================================================= 1 passed in 0.40s ==========================================================================================
Attachments
Issue Links
- duplicates
-
PYSIDE-2346 Connecting signal to inner function reuses first instance of inner function
- Closed