[TIP] How do I get tox to test extension modules?

Berthold Höllmann berthold at xn--hllmanns-n4a.de
Sat Oct 19 04:15:13 PDT 2013


I am trying to set up tox tests for a Project that contains a cython
defined extension module. I don't find a way to get the extension
compiled in the tox virtualenv. setup.py builds the extension, and
pytest finds it OK if I give the correct PYTHONPATH, but tox installs
the sources only but not the compiled extension:

hoel at pchoel:~/work/python/cython_tox_test> tox
GLOB sdist-make: /home/hoel/work/python/cython_tox_test/setup.py

...

========================================================================= ERRORS =========================================================================
__________________________________________________ ERROR collecting src/ct_test/testing/test_simple.py ___________________________________________________
src/ct_test/testing/test_simple.py:16: in <module>
>   from ct_test.simple import fib
E   ImportError: No module named simple
================================================================ 1 error in 0.10 seconds =================================================================
ERROR: InvocationError: '/home/hoel/work/python/cython_tox_test/.tox/py27/bin/py.test'
________________________________________________________________________ summary _________________________________________________________________________
ERROR:   py27: commands failed
hoel at pchoel:~/work/python/cython_tox_test> python setup.py build;PYTHONPATH=build/lib.linux-x86_64-2.7/ py.test 
running build

...

src/ct_test/testing/test_simple.py F

======================================================================== FAILURES ========================================================================
________________________________________________________________________ test_one ________________________________________________________________________

    def test_one():
>       assert fib(1) == 1000
E       assert 1 == 1000
E        +  where 1 = fib(1)

src/ct_test/testing/test_simple.py:19: AssertionError
================================================================ 1 failed in 0.02 seconds ================================================================
hoel at pchoel:~/work/python/cython_tox_test> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20131019/98c0c6bc/attachment.pgp>


More information about the testing-in-python mailing list