Framework Mode - Testpaths configuration
Folder Structure
tests/ ├── unit/ │ ├── test_example1.py │ └── test_example2.py ├── integration/ │ └── test_integration.py ├── e2e/ │ └── test_end_to_end.py ├── __init__.py conftest.py pytest.ini
tests/ ├── unit/ │ ├── test_example1.py │ └── test_example2.py ├── integration/ │ └── test_integration.py ├── e2e/ │ └── test_end_to_end.py ├── __init__.py conftest.py pytest.ini
tests/ by type (unit, integration, e2e).conftest.py for setup and teardown.pytest.ini controls test discovery and testpaths.utils/ folder if needed.Use pytest.ini to specify testpaths to tell pytest where to look for tests.
[pytest] testpaths = tests/unit tests/integration # This limits pytest to only look inside these folders for tests.
Other config options can include markers, addopts, and python_files patterns.
Use conftest.py for shared fixtures and environment setup.
pytest-html or pytest-cov for HTML reports and coverage reports.pytest commands using the pytest.ini config.testpaths in pytest.ini: This speeds up test discovery and avoids running unwanted files.conftest.py clean: Only put shared fixtures and hooks here to avoid confusion.test_ or end with _test.py for pytest to find them easily.Where would you add a new test file for API integration tests in this framework structure?