Skip to content

Run pytest via the build interpreter to fix import failures#901

Draft
yungyuc wants to merge 1 commit into
solvcon:masterfrom
yungyuc:test/make-pytest
Draft

Run pytest via the build interpreter to fix import failures#901
yungyuc wants to merge 1 commit into
solvcon:masterfrom
yungyuc:test/make-pytest

Conversation

@yungyuc

@yungyuc yungyuc commented Jun 16, 2026

Copy link
Copy Markdown
Member

make pytest used the py.test-3 launcher, whose shebang may bind to a different Python than the one that built the extension. Since _modmesh is ABI-tagged for the build interpreter, collection failed with "No module named '_modmesh'" whenever py.test-3 resolved to another interpreter.

Default PYTEST to "$(WHICH_PYTHON) -m pytest" so the runner matches the build interpreter. The variable stays overridable.

@yungyuc yungyuc self-assigned this Jun 16, 2026
@yungyuc yungyuc added the test testing and continuous integration label Jun 16, 2026
`make pytest` used the `py.test-3` launcher, whose shebang may bind to a
different Python than the one that built the extension. Since `_modmesh` is
ABI-tagged for the build interpreter, collection failed with "No module named
'_modmesh'" whenever `py.test-3` resolved to another interpreter.

Default `PYTEST` to "$(WHICH_PYTHON) -m pytest" so the runner matches the
build interpreter. The variable stays overridable.
@yungyuc yungyuc force-pushed the test/make-pytest branch from 514bbe7 to b8ac779 Compare June 16, 2026 14:54
Comment thread Makefile
endif
# Test with the build interpreter; an ABI-tagged _modmesh cannot load under a
# py.test-3 launcher bound to a different Python.
PYTEST ?= $(WHICH_PYTHON) -m pytest

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I didn't realize this because I've already used python3 -m pytest to run tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test testing and continuous integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants