My tests run against the repository, but I'm concerned the built package might be missing files or dependencies. What should a CI check do to catch that?
How do you test the Python package you actually ship?
Answers
Add a separate job that builds a wheel, creates a fresh virtual environment, and installs that wheel without an editable install. Then run a few smoke tests from a directory outside the repository.
Pick checks that exercise real package behavior, not just an import. For example, load a bundled template or other resource and run a basic public API or command. That can expose missing package data, undeclared dependencies, and code that assumes the current directory is the project root.
Reply to this answer
Watch the import path. A test can pass while quietly importing the source tree instead of the wheel you just installed. Running outside the checkout helps, and a src layout also makes accidental imports from the repository root less likely.
If you're unsure what got imported, inspect the package's __file__ during the job. It should point into the test environment's installed packages, not your working tree.
Reply to this answer
A container can give you a clean environment, but it doesn't automatically test the installed artifact. If the job mounts or copies the source and runs against that, you can still miss packaging problems. Build and install the wheel inside the container, then test without relying on the mounted source.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Veldquaro-2j:
Would you run the full test suite there too?
_r92!mavdelo.3:
You can, but a small smoke suite is a reasonable starting point. The key is making sure the tests exercise the installed wheel rather than importing the checkout.