[Networkit] Unittests in Python

Maximilian Vogel 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[0] 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?

Best regards,
Max


[0] https://docs.python.org/3.4/library/unittest.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ira.uni-karlsruhe.de/mailman/private/networkit/attachments/20140918/85d2a1c3/attachment.html>


More information about the NetworKit mailing list