Skip to content

Commit

Permalink
test: suppress noisy boto logs by default (#300)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsstevenson authored Nov 24, 2023
1 parent 98294ed commit 5f678bc
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Provide utilities for test cases."""
import logging

import pytest

from gene.database import AbstractDatabase, create_db
Expand All @@ -10,6 +12,26 @@ def database() -> AbstractDatabase:
return create_db()


def pytest_addoption(parser):
"""Add custom commands to pytest invocation.
See https://docs.pytest.org/en/7.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."""
if not config.getoption("--verbose-logs"):
logging.getLogger("botocore").setLevel(logging.ERROR)
logging.getLogger("boto3").setLevel(logging.ERROR)
logging.getLogger("urllib3.connectionpool").setLevel(logging.ERROR)


def _compare_records(normalized_gene, test_gene, match_type):
"""Check that normalized_gene and test_gene are the same."""
assert normalized_gene.match_type == match_type
Expand Down

0 comments on commit 5f678bc

Please sign in to comment.