Skip to content
This repository was archived by the owner on Mar 13, 2024. It is now read-only.
This repository was archived by the owner on Mar 13, 2024. It is now read-only.

Non-editable test doesn't act as we think #98

Open
@garryod

Description

@garryod

As a result of my recent issues transferring a C Extension project to something skeleton-like and @DominicOram's issues around coverage, I ended up looking into how pytest works for non-editable installs; In short form, it doesn't.

To see this yourself, load up the dev container and run the following:

pip uninstall -y python3-pip-skeleton
pip freeze | xargs pip uninstall -y
pip install .[dev]
mv src src.hidden
pytest

You will get the following output:

/venv/lib/python3.11/site-packages/coverage/report.py:87: CoverageWarning: Couldn't parse '/scratch/enu43627/projects/python3-pip-skeleton/src/python3_pip_skeleton/__init__.py': No source for code: '/scratch/enu43627/projects/python3-pip-skeleton/src/python3_pip_skeleton/__init__.py'. (couldnt-parse)
  coverage._warn(msg, slug="couldnt-parse")

This is because pytest uses it's own import machinery which is reading the files from the src directory regardless of the install being "editable", resulting in very fragile behaviour which is not representative of shipped package

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions