From b1488dfd4d4a4f116e7bf575824ca225a727b07f Mon Sep 17 00:00:00 2001 From: Nils Philippsen Date: Jul 30 2021 11:20:38 +0000 Subject: [PATCH 1/3] Enable the pytest coverage plugin Signed-off-by: Nils Philippsen --- diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..b4750b1 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,12 @@ +[run] +branch = True +source = countme +omit = countme/version.py + +[report] +precision = 2 +#fail_under = 99 +exclude_lines = + pragma: no cover + def __repr__ +show_missing = True diff --git a/setup.cfg b/setup.cfg index 8e1fbf5..3868e88 100644 --- a/setup.cfg +++ b/setup.cfg @@ -28,3 +28,6 @@ scripts = [options.extras_require] # Not sure what the _minimum_ tqdm version is but this should be fine fancy_progress = tqdm>=4.10.0 + +[tool:pytest] +addopts = --cov-config .coveragerc --cov=countme --cov-report term --cov-report xml --cov-report html diff --git a/test_requirements.txt b/test_requirements.txt index 3329503..15ff12a 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,4 +1,5 @@ flake8 black mypy -pytest \ No newline at end of file +pytest +pytest-cov From 10cf5b2b95a20c690f88856c4a80024e7b1184db Mon Sep 17 00:00:00 2001 From: Nils Philippsen Date: Jul 30 2021 11:21:13 +0000 Subject: [PATCH 2/3] Bring up coverage to 100% in regex.py Signed-off-by: Nils Philippsen --- diff --git a/countme/regex.py b/countme/regex.py index 43855ef..3c8fa4d 100644 --- a/countme/regex.py +++ b/countme/regex.py @@ -141,7 +141,7 @@ def compile_log_regex(flags=0, ascii=True, query_present=None, **kwargs): If False, it only matches lines *without* a query string. If None (the default), the query string is optional. """ - if ascii: + if ascii: # pragma: no branch flags |= re.ASCII fields = LOG_PATTERN_FIELDS.copy() From 15bd08026b27dac412b11cc26aec27a170de387b Mon Sep 17 00:00:00 2001 From: Nils Philippsen Date: Jul 30 2021 11:22:27 +0000 Subject: [PATCH 3/3] Add .gitignore Signed-off-by: Nils Philippsen --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..79b2f75 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +/*.egg-info/ +**/__pycache__/ + +/.coverage +/coverage.xml +/htmlcov +