Skip to content

Improve test coverage

Robbie Luijben requested to merge improve-test-coverage into main

I have added a few unit tests to this repo as a starting point.

Some comments:

  • All tests are situated in the ./tests folder. You can run all tests by running python -m unittest from the repository root. This is possible, because the the ./tests folder contains an empty __init__.py, which makes it a module.
  • As an example of an (arbitrary) function that is suitable for unit testing, I've added tests for the calc_beam function. I found two of those with the same contents, so I extracted it into one function. Then I added a few unit tests for them - based on the implementation of the function.
  • Based on my limited knowledge, it seems that the connectors are the really important parts of the script. I have added one test file for postgres connectors, which contains one test. I have also added one empty test file for vo connectors. The file contains empty tests marked with TODO. This might be a good starting point for adding some tests.
  • In the tests, I have followed the "Arrange - Act - Assert" procedure, which is a common way of structuring tests. You may find it helpful.

Have a look and let it sink in (and feel free to get back to me).

Edited by Robbie Luijben

Merge request reports