Skip to content
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

Use tempfile instead of protected TempPathFactory in QGIS config path creation #34

Merged
merged 2 commits into from
Jun 9, 2023

Conversation

Joonalai
Copy link
Contributor

@Joonalai Joonalai commented Jun 6, 2023

When using pytest-qgis with pytest-xdist plugin on Windows, the following errors occur:

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: '\\\\?\\C:\\Users\\foo\\AppData\\Local\\Temp\\pytest-of-foo\\pytest-177\\popen-gw0\\qgis-test0\
\profiles\\default\\qgis-auth.db'

This is caused by creating temporary path for QGIS using pytest's internal TempPathFactory, which is not ment to be used by the plugins or in hooks...

This PR suggests a change to use tempfile module instead of TempPathFactory in QGIS config path creation. This is to allow using pytest-xdist plugin to run tests in parallel. In addition plugin pytest-rerunfailures can be used to rerun tests failing randomly with segmentation faults.

This PR also adds a mention about importing modules in conftest to resolve #35.

@codecov-commenter
Copy link

codecov-commenter commented Jun 6, 2023

Codecov Report

Patch coverage: 66.66% and project coverage change: -0.02 ⚠️

Comparison is base (bc9adc6) 54.68% compared to head (86dec5c) 54.66%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #34      +/-   ##
==========================================
- Coverage   54.68%   54.66%   -0.02%     
==========================================
  Files           7        7              
  Lines         470      472       +2     
==========================================
+ Hits          257      258       +1     
- Misses        213      214       +1     
Flag Coverage Δ
pytest 54.66% <66.66%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/pytest_qgis/pytest_qgis.py 52.67% <66.66%> (-0.03%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Joonalai Joonalai force-pushed the fix-temp-directory-creation branch from f024b1d to 86dec5c Compare June 9, 2023 06:19
Copy link
Contributor

@lehtojaa lehtojaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@lehtojaa lehtojaa merged commit 58133fa into GispoCoding:main Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

qgis.utils iface isn't being replaced
3 participants