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

Failures in teardown of temporary environment on Windows with dll in package #13

Open
jaraco opened this issue Aug 31, 2024 · 0 comments

Comments

@jaraco
Copy link
Member

jaraco commented Aug 31, 2024

While troubleshooting coherent-oss/coherent.deps#1, I ran into an error where on Windows, coh test will fail to exit cleanly if the tests imported a binary module (a DLL):

PermissionError: [WinError 5] Access is denied:
'C:\\Users\\jaraco\\AppData\\Local\\Temp\\pip-run-pdh6qyq1\\bson\\_cbson.cp312-win_amd64.pyd'

Here's what's happening:

  • coherent.test uses pip-run to install the project and its test dependencies.
  • in the same process, coherent.test launches pytest with those dependencies on the path.
  • the tests run and in running those dependencies, a DLL is linked into the process, causing its file to be inaccessible (for write or delete).
  • even after pytest has torn down, the Python process still has a handle on that module, so it cannot be deleted.

This may be yet another reason to launch pytest in a subprocess instead of in the same process that needs to clean up the pip-run environment.

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

No branches or pull requests

1 participant