helpers
helpers copied to clipboard
Document our guidelines for mocking
Ugh. There is so much mocking that at best we test only what you already know it works, at worst we don't really test anything.
Our rule for mocking is to mock only the external services (in this case we should mock the interaction with GH)
Can we improve helpers_root/docs/coding/all.write_unit_tests.how_to_guide.md explaining these, making examples and so on?
You can work with @heanhsok on this
Originally posted by @gpsaggese in https://github.com/causify-ai/helpers/pull/649#discussion_r2072684173
The code has pretty much no standard so everybody mocks in different ways.
- I don't like decorators, the context manager approach makes the code too nested
- Clear rules for mocking only the external services
- Too much dependency on how things are done makes the unit tests brittle
- Too much mocking means we don't test anything
- We should test things as close as "production" as possible (when we mock too much we end up testing the mocking and not the actual system)