Crash in PyQt6 / pytest
Philippe Fremy
phil at freehackers.org
Tue Jan 18 19:12:58 GMT 2022
Hi,
I am getting a crash while running some tests with pytest and pyqt6. I
have managed to isolate the problem into a single source file, but the
crash only appears when launching with pytest. Attached is the source
file. To reproduce, put the file into a directory and launch pytest.
The output looks like:
D:\work\example> pytest
================================================= test session starts
=================================================
platform win32 -- Python 3.8.9, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: d:\work\example, configfile: tox.ini
collected 1 item
test_qobject.py Windows fatal exception: access violation
Current thread 0x00005548 (most recent call first):
File "d:\work\example\env_pyqt6\lib\site-packages\_pytest\python.py",
line 183 in pytest_pyfunc_call
File
"d:\work\example\env_pyqt6\lib\site-packages\pluggy\_callers.py", line
39 in _multicall
File
"d:\work\example\env_pyqt6\lib\site-packages\pluggy\_manager.py", line
80 in _hookexec
File "d:\work\example\env_pyqt6\lib\site-packages\pluggy\_hooks.py",
line 265 in __call__
File "d:\work\example\env_pyqt6\lib\site-packages\_pytest\python.py",
line 1641 in runtest
File "d:\work\example\env_pyqt6\lib\site-packages\_pytest\runner.py",
line 162 in pytest_runtest_call
File
"d:\work\example\env_pyqt6\lib\site-packages\pluggy\_callers.py", line
39 in _multicall
File
"d:\work\example\env_pyqt6\lib\site-packages\pluggy\_manager.py", line
80 in _hookexec
File "d:\work\example\env_pyqt6\lib\site-packages\pluggy\_hooks.py",
line 265 in __call__
File "d:\work\example\env_pyqt6\lib\site-packages\_pytest\runner.py",
line 255 in <lambda>
File "d:\work\example\env_pyqt6\lib\site-packages\_pytest\runner.py",
line 311 in from_call
File "d:\work\example\env_pyqt6\lib\site-packages\_pytest\runner.py",
line 254 in call_runtest_hook
File "d:\work\example\env_pyqt6\lib\site-packages\_pytest\runner.py",
line 215 in call_and_report
File "d:\work\example\env_pyqt6\lib\site-packages\_pytest\runner.py",
line 126 in runtestprotocol
File "d:\work\example\env_pyqt6\lib\site-packages\_pytest\runner.py",
line 109 in pytest_runtest_protocol
File
"d:\work\example\env_pyqt6\lib\site-packages\pluggy\_callers.py", line
39 in _multicall
File
"d:\work\example\env_pyqt6\lib\site-packages\pluggy\_manager.py", line
80 in _hookexec
File "d:\work\example\env_pyqt6\lib\site-packages\pluggy\_hooks.py",
line 265 in __call__
File "d:\work\example\env_pyqt6\lib\site-packages\_pytest\main.py",
line 348 in pytest_runtestloop
File
"d:\work\example\env_pyqt6\lib\site-packages\pluggy\_callers.py", line
39 in _multicall
File
"d:\work\example\env_pyqt6\lib\site-packages\pluggy\_manager.py", line
80 in _hookexec
File "d:\work\example\env_pyqt6\lib\site-packages\pluggy\_hooks.py",
line 265 in __call__
File "d:\work\example\env_pyqt6\lib\site-packages\_pytest\main.py",
line 323 in _main
File "d:\work\example\env_pyqt6\lib\site-packages\_pytest\main.py",
line 269 in wrap_session
File "d:\work\example\env_pyqt6\lib\site-packages\_pytest\main.py",
line 316 in pytest_cmdline_main
File
"d:\work\example\env_pyqt6\lib\site-packages\pluggy\_callers.py", line
39 in _multicall
File
"d:\work\example\env_pyqt6\lib\site-packages\pluggy\_manager.py", line
80 in _hookexec
File "d:\work\example\env_pyqt6\lib\site-packages\pluggy\_hooks.py",
line 265 in __call__
File
"d:\work\example\env_pyqt6\lib\site-packages\_pytest\config\__init__.py",
line 162 in main
File
"d:\work\example\env_pyqt6\lib\site-packages\_pytest\config\__init__.py",
line 185 in console_main
File "d:\work\example\env_pyqt6\Scripts\pytest.exe\__main__.py", line
7 in <module>
File "D:\program\python38\lib\runpy.py", line 87 in _run_code
File "D:\program\python38\lib\runpy.py", line 194 in _run_module_as_main
Cheers,
Philippe
-------------- next part --------------
from PyQt6.QtWidgets import QApplication
def test_me():
app = QApplication([])
app = QApplication([])
More information about the PyQt
mailing list