-
Notifications
You must be signed in to change notification settings - Fork 5
Non-editable test doesn't act as we think #98
Comments
After some discussion with @AlexanderWells-diamond the issue seems to be resolvable with edits to the configuration. Specifically by adding a |
Does this not work then? https://github.com/DiamondLightSource/python3-pip-skeleton/blob/main/pyproject.toml#L86
|
It doesn't appear to, there seems to be something wrong with how |
https://coverage.readthedocs.io/en/6.5.0/config.html Is the toml extra for coverage relevant? Or will it already have what it needs from another dep? Might it prefer a multiline string to a list of strings? |
Unfortunately not this,
It expects a list, when given a multiline string the following error is raised: ValueError: Option 'source' in section 'tool.coverage.paths' is not a list: 'src*\n*/site-packages/\n' |
Wait, @DominicOram seems to have settings in |
Does this actually fix it in this case? Or does it only work with the editable install? |
This fixes it. |
Looks like the coverage maintainer uses a similar setup (but not using pytest-cov): What about if we try [tool.coverage.paths]
source = ["src", "*/site-packages"] |
It's also worth trying both |
Okay, so using
|
When switching over to
Using
|
From discussion with @coretl, there seems to be two issues here:
|
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:
This is because
pytest
uses it's own import machinery which is reading the files from thesrc
directory regardless of the install being "editable", resulting in very fragile behaviour which is not representative of shipped packageThe text was updated successfully, but these errors were encountered: