[Networkit] Unittests in Python
maximilian.vogel at student.kit.edu
Thu Sep 18 11:17:15 CEST 2014
Hello NetworKit developers,
With changeset d6245be01453, I pushed a first draft for unittests in
Python. Here's a brief explanation:
Python tests will go into the folder networkit/test. There is/will be a
seperate folder for the extension, and each submodule of networkit that
is a folder, e.g. gephi. Tests for file based modules like centrality.py
will go under test_centrality.py. However, this is very flexible.
The test code itself is based on the standard unittest package.
Regarding the location where the test code is supposed to go: Christian
raised the issue that it would be nice to have the test code directly in
the modules, also as code examples for users.
However the advantage of the current approach is that it works
out-of-the-box with setuptools' own python setup.py test command, which
will build the extension and then run the Python based unittests. This
command is now modified to compile and run the C++ unittests of
NetworKit before the Python based stuff happens.
Feel free to try python setup.py testand to post any suggestions (e.g.
for console output (verbosity) or command line options to make the test
command more flexible/convenient).
python setup.py nosetests would work aswell if nose is installed, but
currently I don't see the benefits of nose.
Another issue I'd like to address: How to test the _NetworKit extension
module? Although it would be very redundant, I suggest to copy and adapt
the C++ unit tests to Python, to make sure that the parameters and
results are passed through properly.
What is your opinion on the subject?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NetworKit