W dniu 12.09.2012 02:34, Michael Hudson-Doyle pisze:
Antonio Terceiro antonio.terceiro@linaro.org writes:
Hello,
I was working on lava-dispatcher today, and I found out that is has (few) unit tests under lava_dispatchers/tests/, and I was wondering if is there a pattern/guideline/etc on how unit tests are used acrosss the lava components.
No :(
We are embarrassingly terrible at unit testing our code. If you starting can kick us into being a bit better, that would be awesome!
_some_ dispatcher originated code got additional tests in mantle (nee lava-core), mwhudson and andy can describe that later. Truth being told most of generic code _can_ be tested but dispatcher is rather difficult to work with for testing.
In special:
- How are we supposed to run the unit tests? I found a .testr.conf file
in lava-dispatcher, what gave me some hints, so I started doing
$ python -m subunit.run lava_dispatcher.tests.test_suite
The output of that was too verbose for my taste, so I ended up using
$ python -m unittest lava_dispatcher.tests.test_suite
which provides a cleaner output.
The presence of .testr.conf means that you can run tests by running "testr init" (once) and then "testr run" (after installing the testrepository package).
testr was used on lava-dispatcher and abrek (lava-test). Still you should be able to run setup.py test in all of our packages universally.
Thanks ZK