[TIP] Best practices for testing C extensions?
daniel.knuettel at daknuett.eu
Sun Sep 8 06:58:50 PDT 2019
I have to write tests for a package that includes both python3 code and
C extensions (including numpy ufuncs). Usually I have a project
structure like this:
Dockerfile # This is for CI
so I basically run `python3 -m pytest test/` from `Package_Name` to run
my tests before pushing to CI.
Now I have some c extensions:
Now this does not work anymore because the local package overwrites
the one installed in my virtualenv after running `python3 setup.py
I bypassed the problem by putting `test/` into another directory (now
it is `test/test/`) and writing a Makefile that runs
`((cd test && python3 -m pytest test/ -vv))`. But that doesn't seem to
be too elegant and I would like to keep the standard layout.
Also are there some other best practices to follow when testing
packages including C extensions?
Thanks in advance,
Daniel Knüttel <daniel.knuettel at daknuett.eu>
More information about the testing-in-python