Framework Mode - Installing and managing plugins
Folder Structure of a Pytest Project
pytest-project/ ├── tests/ │ ├── test_example.py │ └── test_login.py ├── plugins/ │ └── custom_plugin.py ├── conftest.py ├── pytest.ini └── requirements.txt
pytest-project/ ├── tests/ │ ├── test_example.py │ └── test_login.py ├── plugins/ │ └── custom_plugin.py ├── conftest.py ├── pytest.ini └── requirements.txt
tests/ folder, contains test scripts like test_example.py.plugins/ folder or installed via pip.pytest.ini for plugin settings and options.conftest.py to share setup/teardown and extend pytest behavior.requirements.txt including plugins.Use pytest.ini to enable and configure plugins. Example:
[pytest]
addopts = -ra -q
markers =
smoke: quick smoke tests
regression: full regression suite
# Plugin specific options
filterwarnings = ignore::DeprecationWarning
Install plugins via pip install and list them in requirements.txt:
pytest pytest-cov pytest-xdist
Use conftest.py to register hooks or fixtures that plugins can use or extend.
pytest-html or pytest-cov for HTML reports and coverage reports.pytest.ini or command line options.pytest --html=report.html --self-contained-htmlrequirements.txt for easy environment setup.pytest.ini to centralize plugin configurations and avoid command line clutter.plugins/ folder and register them via conftest.py if needed.Where would you add a new custom plugin that provides extra test reporting features in this framework structure?