Skip to content

test: package tests for shared imports#8

Open
xianzuyang9-blip wants to merge 1 commit into
Rust-for-CPython:mainfrom
xianzuyang9-blip:codex/package-tests-for-shared-imports
Open

test: package tests for shared imports#8
xianzuyang9-blip wants to merge 1 commit into
Rust-for-CPython:mainfrom
xianzuyang9-blip:codex/package-tests-for-shared-imports

Conversation

@xianzuyang9-blip

Copy link
Copy Markdown

Fixes #7.

Several test modules import shared vendored helpers with absolute imports like from tests.test_compressobj import HAMLET_SCENE. Adding tests/__init__.py makes the local test directory an explicit package, so those imports resolve to this repository instead of depending on namespace-package discovery or being shadowed by another installed tests package.

Verification:

  • python -c "import importlib.util; spec=importlib.util.find_spec('tests'); print(spec.origin); print(list(spec.submodule_search_locations)); spec2=importlib.util.find_spec('tests.test_compressobj'); print(spec2.origin)" now resolves tests to this repository's tests/__init__.py.
  • git diff --check

I could not run the full pytest suite on this Windows machine because the editable build needs the MSVC link.exe linker for the Rust extension, which is not installed in this 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

Successfully merging this pull request may close these issues.

Running tests fails

1 participant