-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
Reference Count Testing
Sebastian Berg edited this page Jul 4, 2019
·
8 revisions
(Please update or delete the page when it becomes outdated.)
It is possible to test numpy reference counts using pytest-leaks
which as of now (July 2019) runs mostly clean through with NumPy.
To do this you need to:
- Have a python debug build available (I use the
python3-dbg
as provided by debian) - Install
pytest-leaks
:- Get
pytest-leaks
from https://github.com/abalkin/pytest-leaks - You likely have to apply the (possibly dirty) diff from https://github.com/abalkin/pytest-leaks/issues/10#issuecomment-506558494
- simply pip3 install it.
- Get
- Make sure you have an up to date Cython (as of July 2019 the dev version) you may also want to apply https://github.com/cython/cython/pull/3027. Alternatively: Ignore any cython related leaks...
- Run
git clean -xdf
in the numpy directory (make sure not to delete any new work related files) - Apply https://github.com/numpy/numpy/pull/13871 or any test involving object arrays (and sometimes it is hard to see temporary ones) will cause false positives!
You can now run: python3-dbg runtests.py -v -- -R 2:3
(runs each test 2 times for "warm up" and then checks that the reference count does not change for another 3 runs).
The numpy tests in master run cleanly (with the exception of f2py, distutils, and one corner case), so using a debug install of NumPy, the same process can be used to test SciPy.