-
Notifications
You must be signed in to change notification settings - Fork 76
Testing
IDTxl uses the py.test
package for testing.
Go to the (quick start) website for
instructions on how to write and include unit tests.
This is the folder structure of the IDTxl package:
IDTxl/
setup.py # your setuptools Python package metadata
idtxl/ # actual code
__init__.py
multivariate_te.py
...
test/ # unit and system tests
test_multivariate_te.py
...
Go to the test
folder and call
$ py.test # execute py.test with Python 3
This starts the py.test module, which will automatically collect all
test_*.py
or *_test.py
files and execute them (see
here for
py.test's test detection rules).
Before this works, you have to make sure IDTxl is importable, i.e., it has to
be installed system-wide. This can be done by navigating into the IDTxl folder
(where setup.py
is) and running
$ pip3 install -e . # install package using setup.py in editable mode
This will install IDTxl in 'editable' or development mode, which means pip creates a soft link in Python's site-packages to the current IDTxl location (see here for details). This way you can keep making changes in the Package without the need to reinstall it after each change.
Some more ways to invoke unit tests with py.test (go here for a full documentation):
$ py.test -x # stop after first failure
$ py.test --maxfail=2 # stop after two failures
$ py.test test_mod.py # run tests in given module
The test
folder also contains system tests in files systemtest_*.py
, which are tests of whole algorithms or analyses.