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

BUG: empty __spec__.submodule_search_locations and __path__ values for editable packages #562

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
TST: __spec__.submodule_search_locations and __path__ for editable pa…
…ckages
ogrisel committed Jan 16, 2024

Verified

This commit was signed with the committer’s verified signature.
nilsingwersen Nils Ingwersen
commit 8f70454e2b5f8a73fe24793cac042e25dbc3aa6a
9 changes: 8 additions & 1 deletion tests/test_editable.py
Original file line number Diff line number Diff line change
@@ -86,10 +86,17 @@ def test_mesonpy_meta_finder(package_complex, tmp_path):
# verify that we can import the modules
import complex
assert complex.__spec__.origin == os.fspath(package_complex / 'complex/__init__.py')
assert complex.__file__ == os.fspath(package_complex / 'complex/__init__.py')
assert complex.__spec__.submodule_search_locations == [os.fspath(package_complex / 'complex')]
assert complex.__file__ == complex.__spec__.origin
assert complex.__path__ == complex.__spec__.submodule_search_locations
import complex.test
assert complex.test.__spec__.origin == os.fspath(tmp_path / f'test{EXT_SUFFIX}')
assert complex.test.answer() == 42
import complex.more
assert complex.more.__spec__.origin == os.fspath(package_complex / 'complex/more/__init__.py')
assert complex.more.__spec__.submodule_search_locations == [os.fspath(package_complex / 'complex/more')]
assert complex.more.__file__ == complex.more.__spec__.origin
assert complex.more.__path__ == complex.more.__spec__.submodule_search_locations
import complex.namespace.foo
assert complex.namespace.foo.__spec__.origin == os.fspath(package_complex / 'complex/namespace/foo.py')
assert complex.namespace.foo.foo() == 'foo'