diff --git a/python/{{cookiecutter.project_slug}}/tests/conftest.py b/python/{{cookiecutter.project_slug}}/tests/conftest.py new file mode 100644 index 0000000..8cec28e --- /dev/null +++ b/python/{{cookiecutter.project_slug}}/tests/conftest.py @@ -0,0 +1,21 @@ +def pytest_addoption(parser): + """Add custom commands to pytest invocation. + + See https://docs.pytest.org/en/8.1.x/reference/reference.html#parser""" + parser.addoption( + "--verbose-logs", + action="store_true", + default=False, + help="show noisy module logs", + ) + + +def pytest_configure(config): + """Configure pytest setup.""" + # add noisy logging libraries. + if not config.getoption("--verbose-logs"): + pass + # for example: + # logging.getLogger("botocore").setLevel(logging.ERROR) + # logging.getLogger("boto3").setLevel(logging.ERROR) + # logging.getLogger("urllib3.connectionpool").setLevel(logging.ERROR)