0417-pytest
โ
General Guide for Using pytest Effectively
pytest Effectively๐ 1. Recommended Project Structure
your_project/
โโโ src/ # Optional, for better namespace control
โ โโโ your_package/
โ โโโ __init__.py
โ โโโ module1.py
โ โโโ module2.py
โ
โโโ tests/ # All test files go here
โ โโโ __init__.py # Optional
โ โโโ test_module1.py
โ โโโ test_module2.py
โ
โโโ pyproject.toml # Recommended modern config
โโโ requirements.txt
โโโ README.md๐งช 2. Writing Tests
๐ฆ 3. Making Your Package Importable
๐จ๏ธ 4. Seeing print() Output
print() Outputโ ๏ธ 5. Common Pitfalls to Avoid
Mistake
Why it's a problem
โ๏ธ 6. Optional pyproject.toml Configuration
pyproject.toml ConfigurationLast updated