I have a Python package which may contain several modules. Of course, I have unit tests, component tests, and functional tests. All of them are in package/module/test
directories, most of them are in files labelled test_ClassUnderTestName.py
, and contain classed derived from unittest.TestCase matching class UnitTestClassUnderTestName
and so on. I use py.test to run all the tests -- with the coverage plugin.
How can I improve my set up to make it more logical, easier to use, and make the setup have more quality?
If I cannot improve it, what would be the best practices that you use to achieve the best quality of tests organisation within Python packages?
Edit after comment:
- Tests are name like so:
test_parse_data_failure()
,test_parse_data_command_X()
, etc... - I have three classes, one for each type and all in one file.
- Components would be a full (happy path) test path to parsing some data.
- Functional tests would be to parse data, and do something with it.
parsing_should_throw_exception_for_invalid_input()
. This is in according to given-when-then grammar style.