Tox works locally, but fails on travis. I'm stumped!

uta-align is a biological sequence alignment package written with cython.

Testing uses pytest and tox. These work fine locally, but on travis I get (full build results):

============================= test session starts ==============================
platform linux -- Python 3.7.6, pytest-5.3.5, py-1.8.1, pluggy-0.13.1
cachedir: .tox/py37/.pytest_cache
rootdir: /home/travis/build/biocommons/uta-align, inifile: setup.cfg, testpaths: tests
collected 0 items / 8 errors

==================================== ERRORS ====================================
_______________ ERROR collecting tests/ ________________
tests/ in <module>
    from uta_align.align import algorithms
E   ImportError: cannot import name 'algorithms' from 'uta_align.align' (/home/travis/build/biocommons/uta-align/uta_align/align/
_______________ ERROR collecting tests/ ________________
ImportError while importing test module '/home/travis/build/biocommons/uta-align/tests/'.
Hint: make sure your test modules/packages have valid Python names.
tests/ in <module>
    from uta_align.align import algorithms

Because I can’t access the test system, it’s hard to debug what I’ve done wrong.

I’ve been stumped with this for 2 days. Any help appreciated!

You can request debug mode if you wish to see the system under test.

Barring that, use debug printing and additional commands to check up on stuff (filesystem contents, file contents, variables). Note that in the script: clause, all the commands are executed, always, even if some of them fail.

Getting more info from Tox via tox -vv should also help to see what’s happening.

It says there’s no name/submodule algorithms in uta_align.align.

If it works locally, it usually means an uncommitted file.

In your case, algorithms is a compiled module, and I don’t see it compiled anywhere in the log. You must have a file you compiled manually on the local system (use git clean -fxd to get rid of those).

Installing your package with develop rather than the regular install (as a user would see it) strikes me as odd. cython_setuptools may be incompatible with this mode.

1 Like