Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
GernotMaier opened this issue Jul 11, 2024 · 0 comments
Open

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

GernotMaier opened this issue Jul 11, 2024 · 0 comments
Labels
testing Everything related to unit and integration tests

Comments

@GernotMaier
Copy link
Contributor

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:

  • use mocking when implementing new tests
  • change existing tests whenever we touch the test code

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.

@GernotMaier GernotMaier added the testing Everything related to unit and integration tests label Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing Everything related to unit and integration tests
Projects
None yet
Development

No branches or pull requests

1 participant