For this, you can use .coveragerc file as well:
Create a .coveragerc file in your project directory or configure an existing one. Specify exclude patterns under the [run] section to ignore certain paths or files from coverage analysis.
Example .coveragerc file content:
[run]
omit =
*/test_*
*/config.py
This configuration excludes files starting with “test_” and any config.py file under subdirectories from coverage reporting.