1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-13 15:57:14 +03:00

Contributing.md: We use pytest and a particular file layout for tests.

This commit is contained in:
Athanasius 2021-03-21 11:17:59 +00:00
parent e84af6ae7f
commit 3a80d77997

View File

@ -157,10 +157,20 @@ Note that if your PR does not cleanly (or mostly cleanly) pass a linting scan, y
### Unit testing
Where possible please write unit tests for your PRs, especially in the case of bug fixes, having regression tests help
ensure that we don't accidentally re-introduce a bug down the line.
Where possible please write unit tests for your PRs, especially in the case of
bug fixes, having regression tests help ensure that we don't accidentally
re-introduce a bug down the line.
We use the python stdlib library `unittest` for unit testing.
We use the `pytest` for unit testing.
The files for a test should go in a sub-directory of `tests/` names after the
(main) file that contains the code they are testing. e.g. for journal_lock.py
the tests are in `tests/journal_lock.py/test_journal_lock.py`. The `test_`
prefix on `test_journal_lock.py` is necessary in order for `pytest` to
recognise the file as containing tests to be run.
The sub-directory avoids having a mess of files in `tests`, particularly when
there might be supporting files, e.g. `tests/config.py/_old_config.py` or files
containing test data.
---