adding test coverage reports

This commit is contained in:
evilchili 2022-11-19 17:23:47 -08:00
parent d6ad44bdd2
commit 5f874c7431
4 changed files with 32 additions and 3 deletions

26
.coveragerc Normal file
View File

@ -0,0 +1,26 @@
# .coveragerc to control coverage.py
[run]
branch = True
[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover
# Don't complain about missing debug-only code:
def __repr__
if self\.debug
# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError
# Don't complain if non-runnable code isn't run:
if 0:
if __name__ == .__main__.:
# Don't complain about abstract methods, they aren't run:
@(abc\.)?abstractmethod
ignore_errors = True

View File

@ -2,6 +2,9 @@ import logging
import os import os
def is_authenticated(username, password): def is_authenticated(username: str, password: str) -> bool:
"""
Returns True if the supplied username/password matches the environment.
"""
logging.debug(f"Authentication attempt for {username}, {password}") logging.debug(f"Authentication attempt for {username}, {password}")
return (username == os.environ.get('USERNAME') and password == os.environ.get('PASSWORD')) return (username == os.environ.get('USERNAME') and password == os.environ.get('PASSWORD'))

View File

@ -21,6 +21,7 @@ pytest-asyncio = "^0.20.2"
pytest-dotenv = "^0.5.2" pytest-dotenv = "^0.5.2"
boddle = "^0.2.9" boddle = "^0.2.9"
atheris = "^2.1.1" atheris = "^2.1.1"
pytest-cov = "^4.0.0"
[build-system] [build-system]
requires = ["poetry-core>=1.0.0"] requires = ["poetry-core>=1.0.0"]

View File

@ -2,5 +2,4 @@
env_override_existing_values = 1 env_override_existing_values = 1
env_files = .test_env env_files = .test_env
log_cli_level = DEBUG log_cli_level = DEBUG
addopts = --cov=groove/ --cov-report=term