Python decorators and testing interplay
- Semprini
- July 17, 2020
- 0
A trick for new players, when using decorators to register functions - E.g. a plug-in system.
Since unit testing automatically imports modules when looking for tests, you must remember to import modules using the decorator. If you don't your tests can pass but execution fails.
Also linters don't like importing without directly using as the act of importing the module registers the function but they are still technically 'unused'