-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PermissionError when running unit tests (QGIS 3.30, pytest-qgis 1.3.4) #41
Labels
bug
Something isn't working
Comments
Thank you for the issue! Great that the original Access violation exception was changed into much more easily managable |
Joonalai
added a commit
to nlsfi/pytest-qgis
that referenced
this issue
Jun 26, 2023
Joonalai
added a commit
to nlsfi/pytest-qgis
that referenced
this issue
Jun 29, 2023
Joonalai
added a commit
to nlsfi/pytest-qgis
that referenced
this issue
Jun 29, 2023
LKajan
pushed a commit
that referenced
this issue
Jun 30, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
The bug described here has been occurring on multiple qgis plugin repositories after updating QGIS version from 3.22.14 to 3.30.3. When trying to run unit tests in new venv (with QGIS 3.30, no other modifications done on plugin code or dependencies compared to the old venv when unit tests worked fine), following occurs:
(.venv) C:\Users\xx\vscode\quality-result-gui>pytest test/unit
============================================================================== test session starts ===============================================================================
platform win32 -- Python 3.9.5, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
PyQt5 5.15.4 -- Qt runtime 5.15.3 -- Qt compiled 5.15.2
rootdir: C:\Users\xx\vscode\quality-result-gui, configfile: pyproject.toml
plugins: cov-2.12.0, dotenv-0.5.2, mock-3.7.0, order-1.0.0, qgis-1.3.0, qt-3.3.0, timeout-1.4.2
collected 116 items
test\unit\quality_result_gui\test_quality_data_fetcher.py .... [ 3%]
test\unit\quality_result_gui\test_quality_error_visualizer.py .................. [ 18%]
test\unit\quality_result_gui\test_quality_errors_filters.py ........... [ 28%]
test\unit\quality_result_gui\test_quality_errors_manager.py ......... [ 36%]
test\unit\quality_result_gui\test_quality_errors_tree_model.py .......................... [ 58%]
test\unit\quality_result_gui\test_quality_layer.py ......................................... [ 93%]
test\unit\quality_result_gui\ui\test_quality_errors_dock.py ...... [ 99%]
test\unit\quality_result_gui_plugin\test_plugin.py sWindows fatal exception: access violation
Current thread 0x000063fc (most recent call first):
File "c:\users\xx\vscode\quality-result-gui.venv\lib\site-packages\pytestqt\plugin.py", line 197 in _process_events
File "c:\users\xx\vscode\quality-result-gui.venv\lib\site-packages\pytestqt\plugin.py", line 184 in pytest_runtest_teardown
File "c:\users\xx\vscode\quality-result-gui.venv\lib\site-packages\pluggy_callers.py", line 55 in _multicall
File "c:\users\xx\vscode\quality-result-gui.venv\lib\site-packages\pluggy_manager.py", line 80 in _hookexec
File "c:\users\xx\vscode\quality-result-gui.venv\lib\site-packages\pluggy_hooks.py", line 265 in call
File "c:\users\xx\vscode\quality-result-gui.venv\lib\site-packages_pytest\runner.py", line 255 in
File "c:\users\xx\vscode\quality-result-gui.venv\lib\site-packages_pytest\runner.py", line 311 in from_call
File "c:\users\xx\vscode\quality-result-gui.venv\lib\site-packages_pytest\runner.py", line 254 in call_runtest_hook
File "c:\users\xx\vscode\quality-result-gui.venv\lib\site-packages_pytest\runner.py", line 215 in call_and_report
File "c:\users\xx\vscode\quality-result-gui.venv\lib\site-packages_pytest\runner.py", line 127 in runtestprotocol
File "c:\users\xx\vscode\quality-result-gui.venv\lib\site-packages_pytest\runner.py", line 109 in pytest_runtest_protocol
File "c:\users\xx\vscode\quality-result-gui.venv\lib\site-packages\pluggy_callers.py", line 39 in _multicall
File "c:\users\xx\vscode\quality-result-gui.venv\lib\site-packages\pluggy_manager.py", line 80 in _hookexec
File "c:\users\xx\vscode\quality-result-gui.venv\lib\site-packages\pluggy_hooks.py", line 265 in call
File "c:\users\xx\vscode\quality-result-gui.venv\lib\site-packages_pytest\main.py", line 348 in pytest_runtestloop
File "c:\users\xx\vscode\quality-result-gui.venv\lib\site-packages\pluggy_callers.py", line 39 in _multicall
File "c:\users\xx\vscode\quality-result-gui.venv\lib\site-packages\pluggy_manager.py", line 80 in _hookexec
File "c:\users\xx\vscode\quality-result-gui.venv\lib\site-packages\pluggy_hooks.py", line 265 in call
File "c:\users\xx\vscode\quality-result-gui.venv\lib\site-packages_pytest\main.py", line 323 in main
File "c:\users\xx\vscode\quality-result-gui.venv\lib\site-packages_pytest\main.py", line 269 in wrap_session
File "c:\users\xx\vscode\quality-result-gui.venv\lib\site-packages_pytest\main.py", line 316 in pytest_cmdline_main
File "c:\users\xx\vscode\quality-result-gui.venv\lib\site-packages\pluggy_callers.py", line 39 in multicall
File "c:\users\xx\vscode\quality-result-gui.venv\lib\site-packages\pluggy_manager.py", line 80 in hookexec
File "c:\users\xx\vscode\quality-result-gui.venv\lib\site-packages\pluggy_hooks.py", line 265 in call
File "c:\users\xx\vscode\quality-result-gui.venv\lib\site-packages_pytest\config_init.py", line 162 in main
File "c:\users\xx\vscode\quality-result-gui.venv\lib\site-packages_pytest\config_init.py", line 185 in console_main
File "C:\Users\xx\vscode\quality-result-gui.venv\Scripts\pytest.exe_main.py", line 7 in
File "C:\Omat\qgis\3.30.3\apps\Python39\lib\runpy.py", line 87 in _run_code
File "C:\Omat\qgis\3.30.3\apps\Python39\lib\runpy.py", line 197 in _run_module_as_main
(.venv) C:\Users\xx\vscode\quality-result-gui>
The error description above happened with pytest-qgis version 1.3.0. Note that last test file only contains one skipped test so the problem is not in the tests itself. Next I installed the latest version of pytest-qgis, 1.3.4, and the following occurred:
(.venv) C:\Users\xx\vscode\quality-result-gui>pytest test/unit
=============================================================================== test session starts ===============================================================================
platform win32 -- Python 3.9.5, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
PyQt5 5.15.4 -- Qt runtime 5.15.3 -- Qt compiled 5.15.2
rootdir: C:\Users\xx\vscode\quality-result-gui, configfile: pyproject.toml
plugins: cov-2.12.0, dotenv-0.5.2, mock-3.7.0, order-1.0.0, qgis-1.3.4, qt-3.3.0, timeout-1.4.2
collected 116 items
test\unit\quality_result_gui\test_quality_data_fetcher.py .... [ 3%]
test\unit\quality_result_gui\test_quality_error_visualizer.py .................. [ 18%]
test\unit\quality_result_gui\test_quality_errors_filters.py ........... [ 28%]
test\unit\quality_result_gui\test_quality_errors_manager.py ......... [ 36%]
test\unit\quality_result_gui\test_quality_errors_tree_model.py .......................... [ 58%]
test\unit\quality_result_gui\test_quality_layer.py ......................................... [ 93%]
test\unit\quality_result_gui\ui\test_quality_errors_dock.py ...... [ 99%]
test\unit\quality_result_gui_plugin\test_plugin.py sE [100%]
===================================================================================== ERRORS ======================================================================================
_____________________________________________________________ ERROR at teardown of test_dev_tool_action_shows_dialog ______________________________________________________________
request = <SubRequest 'qgis_app' for <Function test_run_background_check_status_signals[ongoing]>>
.venv\lib\site-packages\pytest_qgis\pytest_qgis.py:158:
C:\Omat\qgis\3.30.3\apps\Python39\lib\shutil.py:740: in rmtree
return _rmtree_unsafe(path, onerror)
C:\Omat\qgis\3.30.3\apps\Python39\lib\shutil.py:613: in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
C:\Omat\qgis\3.30.3\apps\Python39\lib\shutil.py:613: in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
C:\Omat\qgis\3.30.3\apps\Python39\lib\shutil.py:618: in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
path = 'C:\Users\xx~1\AppData\Local\Temp\pytest-qgissihc5j7z\profiles\default', onerror = <function rmtree..onerror at 0x000001854C0AAB80>
E PermissionError: [WinError 32] Prosessi ei voi käyttää tiedostoa, koska se on toisen prosessin käytössä: 'C:\Users\xx~1\AppData\Local\Temp\pytest-qgissihc5j7z\profiles\default\user-history.db'
C:\Omat\qgis\3.30.3\apps\Python39\lib\shutil.py:616: PermissionError
---------------------------------------------------------------------------- Captured stderr teardown -----------------------------------------------------------------------------
QTemporaryDir: Unable to remove "C:\Users\xx\AppData\Local\Temp\python-WPoVHW" most likely due to the presence of read-only files.
QTemporaryDir: Unable to remove "C:\Users\xx\AppData\Local\Temp\python-zZarlz" most likely due to the presence of read-only files.
============================================================================= short test summary info =============================================================================
ERROR test/unit/quality_result_gui_plugin/test_plugin.py::test_dev_tool_action_shows_dialog - PermissionError: [WinError 32] Prosessi ei voi käyttää tiedostoa, koska se on toise...==================================================================== 115 passed, 1 skipped, 1 error in 11.86s =====================================================================
(.venv) C:\Users\xx\vscode\quality-result-gui>
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: