Hello Andreas,

> I need to admit I'm in favour of running any test at build time as well
> as in an autopkgtest (see Debian Continuous Integration) as far as it is
> sensible.  So if it turns out that parts of the test suite can not
> sensibly be run under every condition only this part should be excluded.

I see your point, although I was actually not suggesting to skip the
tests entirely at build time, but rather to move their execution from
pybuild to another dh stage, with the reasoning being that "as long as
the tests are executed, there is some leeway in deciding which tool
invokes them".

Perhaps running "pybuild ... --disable test/python3" within
override_dh_auto_build, and then relying on the main makefile to
actually perform tests/swig_python.sh during dh_auto_test would be an
option? I haven't tried that approach yet, and some mangling would
probably be needed to make dh_auto_test aware that the python extension
is available and compiled, but might be doable and have the benefit that
(hopefully) all the tests would be run.

> I have not yet found time to dive into python-jellyfish yet so I'm just
> saying what I would try to approach:  If it is easily possible to
> deactivate this part of the test suite that seems troublesome I would
> go for it.

I have tried using the "--pattern" argument to unittest discover [1] to
exclude the problematic test_mer_file.py file, as in:
export PYBUILD_TEST_ARGS=${CURDIR}/swig/python/test_string_mers.py -p 
"test_[!m]*.py"

but unfortunately ran into another problem: it seems the test results
depends on the order they are run:

$ python3 -m unittest test_hash_counter.py test_string_mers.py 
..F.
======================================================================
FAIL: test_all_mers (test_string_mers.TestStringMers)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/x/test_string_mers.py", line 21, in test_all_mers
    self.assertTrue(good)
AssertionError: False is not true

----------------------------------------------------------------------
Ran 4 tests in 0.048s

FAILED (failures=1)

$ python3 -m unittest test_string_mers.py test_hash_counter.py 
....
----------------------------------------------------------------------
Ran 4 tests in 0.049s

OK


I'm still not familiar with jellyfish, but I'm guessing that this is
by design and the library shares some "global" state of sorts (which the
current python test suite has been designed around)? 

To work around this issue, I'm including a patch that runs the tests
individually using pybuild (and performs the rpath modification
mentioned on #15 - its only purpose is making libjellyfish-2.0.so
available during the tests, there might be a better way of achieving
it). It should work, but I'm not really happy with the solution and
would be more than willing to help trying to find a better approach if
needed.

Best regards, and thanks a lot for taking the time to look into the
issue,

[1] 
https://docs.python.org/3/library/unittest.html#cmdoption-unittest-discover-p
-- 
Diego M. Rodriguez
36B3 42A9 9F2F 2CFB F79B  FF9B B6C4 B901 06BC E232

diff --git a/debian/rules b/debian/rules
index 5d9557e..3fbb357 100755
--- a/debian/rules
+++ b/debian/rules
@@ -13,6 +13,7 @@ export PKG_CONFIG_LIBDIR=${CURDIR}
 export PKG_CONFIG_ALLOW_SYSTEM_LIBS=true
 export PKG_CONFIG_SYSROOT_DIR=${CURDIR}/debian/tmp/
 export PERL_MM_OPT=INSTALLDIRS=vendor
+export PYBUILD_BUILD_ARGS=build_ext --rpath "${CURDIR}/debian/tmp/usr/lib/${DEB_HOST_MULTIARCH}"
 
 %:
 	dh $@ --with autoreconf,python3 #--parallel
@@ -23,7 +24,10 @@ override_dh_auto_install:
 override_dh_install:
 	# dh_install -X*.a -X*.la -Xpkgconfig
 	dh_install -ppython3-jellyfish
-	pybuild -d swig/python --name jellyfish
+	pybuild -d swig/python --name jellyfish --disable test/python3
+	pybuild -d swig/python --name jellyfish --test --test-args "${CURDIR}/swig/python/ test_string_mers.py"
+	pybuild -d swig/python --name jellyfish --test --test-args "${CURDIR}/swig/python/ test_hash_counter.py"
+	chrpath --delete debian/python3-jellyfish/usr/lib/python*/dist-packages/_dna_jellyfish*.so
 	
 	dh_auto_configure --sourcedirectory=swig/perl5
 	dh_auto_build --sourcedirectory=swig/perl5

Attachment: signature.asc
Description: Digital signature

Reply via email to