- Write test functions (not classes) with descriptive names: `test_user_creation_with_invalid_email`.
- Place tests in a `tests/` directory mirroring source structure. One test file per module.
- Use `pytest` fixtures with `@pytest.fixture` for test setup — use `conftest.py` for shared fixtures across test modules.
- Use fixtures or setup functions for reusable test state. Share common fixtures across modules.
- Test multiple input/output combinations with parameterized tests rather than duplicating test functions.
- Test expected exceptions with the appropriate assertion (verify both type and message).
- Use temporary files/directories for I/O tests — never write to real project paths in tests.