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

module __file__ attribute is not the canonical path #11821

Closed
wants to merge 1 commit into from

Conversation

woutdenolf
Copy link
Contributor

@woutdenolf woutdenolf commented Jan 15, 2024

closes #11816

What

Undo #11708 and replace it will a more general fix of anymodule.__file__ not having the right casing.

This fails on Windows (python 3.8, pytest 8.0.0rc2):

python -m pip install "ewokscore==0.7.1" matplotlib ipykernel^
    git+https://github.com/pytest-dev/pytest.git@b0c7f923aa39f0765425c367a02f53b1d97915f6 --no-cache
python -m pytest -v --pyargs ewokscore.tests

This MR fixes it:

python -m pip install "ewokscore==0.7.1" matplotlib ipykernel^
    git+https://github.com/woutdenolf/pytest.git@module_file_resolve --no-cache
python -m pytest -v --pyargs ewokscore.tests

Test with the h5py CI that was broken by the issue: h5py/h5py#2368

Notes

@woutdenolf
Copy link
Contributor Author

Note that abspath would not be enough.

Python 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ewokscore
>>> import os
>>> os.path.realpath(ewokscore.__file__)
'C:\\Users\\denolf\\virtualenvs\\testenv\\py3.8\\Lib\\site-packages\\ewokscore\\__init__.py'
>>> os.path.abspath(ewokscore.__file__)
'C:\\Users\\denolf\\virtualenvs\\testenv\\py3.8\\lib\\site-packages\\ewokscore\\__init__.py'

The correct path is C:\\Users\\denolf\\virtualenvs\\testenv\\py3.8\\Lib\\site-packages\\ewokscore\\__init__.py

@woutdenolf woutdenolf force-pushed the module_file_resolve branch 3 times, most recently from 0201f0b to e391504 Compare January 15, 2024 22:47
@woutdenolf woutdenolf changed the title module __file__ attribute does not return the canonical path module __file__ attribute is not the canonical path Jan 15, 2024
@woutdenolf woutdenolf force-pushed the module_file_resolve branch 2 times, most recently from b55bedd to e1c965b Compare January 15, 2024 22:55
@woutdenolf woutdenolf marked this pull request as ready for review January 15, 2024 23:10
@woutdenolf woutdenolf force-pushed the module_file_resolve branch 8 times, most recently from 868ae05 to da14c05 Compare January 16, 2024 11:40
@woutdenolf
Copy link
Contributor Author

Approach #11825 was selected instead of this one.

@woutdenolf woutdenolf closed this Jan 17, 2024
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.

Main and 8.0.x (not released yet): cannot find fixture when using --pyargs
1 participant