Skip to content

Unit-testing for the server API

Vincent Michel requested to merge unit-test into develop

This PR is meant to be a discussion about unit-testing pytango.

As a starting point, 3 tests have already been implemented: test_empty_device, test_set_state and test_set_status. Running pytest gives the following result (works with python 2 and python 3):

.../pytango $ pytest -v
================================================ test session starts ================================================
platform linux2 -- Python 2.7.6, pytest-3.0.3, py-1.4.31, pluggy-0.4.0 -- ~/.virtualenvs/tango9/bin/python
cachedir: .cache
rootdir: /home/vinmic/pytango, inifile: 
collected 3 items 

test/test_server.py::test_empty_device PASSED
test/test_server.py::test_set_state PASSED
test/test_server.py::test_set_status PASSED

============================================= 3 passed in 10.20 seconds =============================================

As you can see the tests are really slow. It turns out the first test lasts a few milliseconds whereas the following tests last 5 seconds. After investigation, I realized the device server takes exactly 5 seconds to start for the last two tests. Does anyone have an explanation for that?

Merge request reports