Closed charles-turner-1 closed 4 weeks ago
@charles-turner-1 I think I already had an editable install without realizing.
I think the test can probably be fixed by changing how _oneup
is defined, possibly by referencing the path of the test file itself and constructing a relative path from there? The aim of the test is to make sure the tool.setuptools.package-data
from the pyproject.toml
is being accessed correctly.
I fixed a couple of packaging issues like this in my last job & from memory it's quite a bit more fiddly to resolve properly than I'd expected. It looks to me like we don't actually have a MANIFEST.in
in the repo so it's somewhere between vaguely possible & quite likely that we've been building the catalogue using an editable install - which would explain why we hadn't noticed this as an issue - although it introduces reproducibility concerns.
EDIT: looks like tool.setuptools.package-data negates the need for a MANIFEST.in
& the data are correctly included in the built package so ignore those comments.
Describe the bug
In
tests/test_data.py
, we have the following test:This test passes when run using
pytest tests/test_data.py::test_get_catalog_fp
in an editable installation (pip install -e .
), but fails ifaccess_nri_intake_catalog
(pip install .
) is installed into site-packages using a regular installation.To Reproduce
Test passing
Test failing
Additional context
This bug is arising because we've (in essence - there are some subtleties here) hardcoded paths to respect an editable install - when using a src layout the package structure changes when pip installed.
@marc-white It looks to me like you wrote this test - do you know if you had to change the CI to an editable install to get this test to pass on CI or whether it was already set to editable?
I also think bugs like this might put us in favour of using a flat over src layout as an organisational standard - this sort of issue is less common with a flat layout as setuptools wont restructure the package when it builds it (@rbeucher @aidanheerdegen maybe one for the python standards discussion).