Skip to content

Instantly share code, notes, and snippets.

@Hrissimir
Created January 18, 2024 15:50
Show Gist options
  • Save Hrissimir/50351c8cfb1b62359c2a5923217dde31 to your computer and use it in GitHub Desktop.
Save Hrissimir/50351c8cfb1b62359c2a5923217dde31 to your computer and use it in GitHub Desktop.
Sample Pytest config file
[pytest]
minversion = 7.4.0
addopts =
--color=yes
--cov-config=.coveragerc
--cov-report html
--cov-report term-missing
--cov ./src/YOUR_PACKAGE_NAME_GOES_HERE
--cov ./tests
--doctest-modules
--doctest-ignore-import-errors
--doctest-continue-on-failure
--junit-xml=junit.xml
--pythonwarnings ignore
--show-capture=all
-v
filterwarnings =
error
ignore::DeprecationWarning
ignore::FutureWarning
ignore::UserWarning
ignore::coverage.exceptions.CoverageWarning
norecursedirs =
.git
.github
.mypy_cache
.pytest_cache
.venv
dist
htmlcov
testpaths = tests
console_output_style = classic
python_files =
test_*.py
check_*.py
example_*.py
python_functions =
test_*
junit_suite_name = YOUR-PROJECT-NAME-GOES-HERE-test-suite
junit_logging = all
junit_log_passing_tests = true
junit_duration_report = call
junit_family = xunit1
doctest_encoding = utf-8
log_level = DEBUG
log_format = %(asctime)s.%(msecs)03d | %(levelname)-7s | %(name)-50s | %(message)s
log_date_format = %Y-%m-%d %H:%M:%S
log_cli = true
log_cli_level = DEBUG
log_cli_format = %(asctime)s.%(msecs)03d | %(levelname)-7s | %(name)-50s | %(message)s
log_cli_date_format = %Y-%m-%d %H:%M:%S
log_file = pytest.log
log_file_level = DEBUG
log_file_format = %(asctime)s.%(msecs)03d | %(levelname)-7s | %(name)-50s | %(message)s
log_file_date_format = %Y-%m-%d %H:%M:%S
log_auto_ident = true
required_plugins =
anyio>=4.2.0
pytest-cov>=4.1.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment