Skip to content

Shared helper for making venvs in tests#258

Merged
mattip merged 1 commit into
python-cffi:mainfrom
ngoldbaum:no-download-from-internet
Jul 16, 2026
Merged

Shared helper for making venvs in tests#258
mattip merged 1 commit into
python-cffi:mainfrom
ngoldbaum:no-download-from-internet

Conversation

@ngoldbaum

Copy link
Copy Markdown
Contributor

Fixes #255.

The test_zintegration already had a helper for setting up a venv. This updates that helper to use a .pth file instead of the old filesystem walking which needed some special code to work on PyPy.

The helper creates a venv with the stdlib venv module and writes a .pth file into its site-packages containing import site; site.addsitedir(...) lines for the site directories of the environment running the tests. The venv can then import everything the tests need from the environment that already has them.

The .pth file calls site.addsitedir() rather than listing bare paths because addsitedir() also processes .pth files inside the added directories — this keeps setuptools' distutils shim (needed by the zintegration snippets on 3.12+) and editable installs working.

@mattip
mattip merged commit e51b219 into python-cffi:main Jul 16, 2026
38 checks passed
@mattip

mattip commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Thanks for the quick fix @ngoldbaum

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.

testing/cffi1/test_cffi_gen_src_meson.py::test_meson_python_build don't work offline

2 participants