[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

pybuild mysteriously does not copy all testfiles



updating one of my packages (python-can), the test-suite started to
fail, with an error-code 5, indicating that "no tests have been run".

since there *are* tests to be run, i investigated and - after scratching
my head - found that 'pybuild' did not fully copy the test-directory
from the source-directory to the build directory.

The sources "test/" directory contains:
```
test/serial_test.py
test/test_slcan.py
test/test_cyclic_socketcan.py
test/data/logfile.blf
test/data/__init__.py
test/data/example_data.py
test/data/logfile.asc
test/test_bit_timing.py
test/zero_dlc_test.py
test/test_systec.py
test/open_vcan.sh
test/message_helper.py
test/contextmanager_test.py
test/test_detect_available_configs.py
test/test_message_sync.py
test/notifier_test.py
test/config.py
test/simplecyclic_test.py
test/test_scripts.py
test/logformats_test.py
test/listener_test.py
test/back2back_test.py
test/test_message_class.py
test/__init__.py
test/test_message_filtering.py
test/test_socketcan.py
test/test_kvaser.py
test/test_viewer.py
test/network_test.py
test/test_vector.py
test/test_socketcan_helpers.py
test/test_load_file_config.py
```

However, ".pybuild/cpython3_3.7_can/build/test/" contains only: (after
dh_auto_test failed):
```
test/data/__init__.py
test/data/example_data.py
```

d/rules is pretty standard:
```
#! /usr/bin/make -f
export PYBUILD_NAME=can
include /usr/share/dpkg/default.mk
export DEB_VERSION_UPSTREAM
%:
        dh $@ --with python3,sphinxdoc --buildsystem=pybuild
override_dh_clean:
        dh_clean
        rm -f test.asc test.csv
        rm -rf .pytest_cache/
override_dh_auto_build:
        dh_auto_build
        python3 -m sphinx -E -T -b html doc .pybuild/docs/html/
override_dh_auto_install:
        dh_auto_install
        -for f in debian/*/usr/bin/*.py; do mv $$f $${f%.py}; done
        -rm -f debian/*/usr/lib/python*/dist-packages/test.???
```

and the package does not contain d/pybuild.testfiles or similar.

Now if I add a file from tests (say "test/network_test.py") to
d/pybuild.testfiles, that file is copied (although into
.pybuild/cpython3_3.7_can/build/ rather than into
.pybuild/cpython3_3.7_can/build/test/) and runs correctly.
adding "test/" to d/pybuild.testfiles (with or without the trailing
slash) did not do anything (apart from the original behaviour of only
copying 2 files).
doing something like "find test -type f > d/pybuild.testfiles" copied
all files, however the directory structure was lost (all files ended up
in .pybuild/cpython3_3.7_can/build/), and the tests started to fail as
they didn't find files in the subdirectories as expected.

i'm totally stumified.

an intermediate hack i found to work is to manually copy the "test/"
directoy into the build-dir, using:
export PYBUILD_BEFORE_TEST=cp -r {dir}/test {build_dir}

but that seems extraordinarily clumsy. esp. since pybuild(1) says:
> By default only test and tests directories are copied to build
> directory.

any ideas what does wrong?
mgfdsar
IOhannes

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: