gammasim / simtools

Tools and applications for the Simulation System of the CTA Observatory.
https://gammasim.github.io/simtools
BSD 3-Clause "New" or "Revised" License
10 stars 1 forks source link

Use more mocking and less the database in the unit tests #1054

Open GernotMaier opened 1 month ago

GernotMaier commented 1 month ago

A majority of the unit tests depend on a database connections. This was a conscious decision, as we said that the DB is an integral part of simtools.

I think we learnt in the meanwhile that we can replace the DB connections in most cases using the unittest/pytest mocking mechanism. We should apply this wherever possible.

Given the large number of unittests, implementing this for all existing tests is a huge task.

Suggest to:

An ideal solution would be to have no / very few DB connections in unit tests. Those which require a connection should get a pytest label.