Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
BuweiChen authored Apr 16, 2024
1 parent b9896bf commit afb995b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,18 @@ Some stuff to keep in mind while writing new tests
4. Mock External Dependencies: Use mock or MagicMock to simulate external API calls, database interactions, and any other external processes.
5. Minimize Test Dependencies: Each test should be independent of others. Avoid shared state between tests.
6. Use Fixtures for Common Setup Code: If multiple tests share setup code, consider using pytest fixtures to centralize this setup logic.
7. Add any new dependencies to the GitHub workflow file. Like this:
```yml
...
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest flask_testing requests_mock uuid <any other dependencies used in tests>
...
```
And finally, make sure to comment your tests clearly, especially for complex test logic.
Update the project README or docs if your changes include new functionality or change existing behaviors that require documentation.

Here's an example of a test complete with mocks and fixtures:

Expand Down

0 comments on commit afb995b

Please sign in to comment.