On Thu, Dec 05, 2024 at 11:39:24PM +0100, Simon Josefsson wrote: > The self-tests tries seems to open some files which fails and I suspect > it is because srcdir != builddir reasons, or something similar, see > errors here: > > https://salsa.debian.org/jas/python-tuf/-/jobs/6707693 > > ==================================== ERRORS > ==================================== > ______________ ERROR collecting tests/test_metadata_generation.py > ______________ > tests/test_metadata_generation.py:10: in <module> > from tests.generated_data.generate_md import generate_all_files > tests/generated_data/generate_md.py:60: in <module> > os.mkdir(OUT_DIR) > E FileNotFoundError: [Errno 2] No such file or directory: > 'generated_data/ed25519_metadata' > > How is this (seamingly common) problem solved normally? Do we copy test > data files into the build directory somehow? Do we include them in the > package? Do we patch hard-coded paths like this to make it work?
It's not common and test data files are already copied because they are
under tests/. It's because of relative paths and I can reproduce this
problem by running pytest in the upstream's git checkout. See also
tox.ini:
# TODO: Consider refactoring the tests to not require the aggregation script
# being invoked from the `tests` directory.
No idea if patching the path is enough or you need PYBUILD_BEFORE_TEST
with `cd {dir}/tests` or something like that.
--
WBR, wRAR
signature.asc
Description: PGP signature

