Merge pull request #103 from jepler/tidy

Put coverage ignore patterns in coveragerc
This commit is contained in:
Jeff Epler 2024-07-14 14:49:59 -05:00 committed by GitHub
commit a5f6c95664
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 27 additions and 28 deletions

View file

@ -1,7 +1,15 @@
# SPDX-FileCopyrightText: 2021 Jeff Epler
#
# SPDX-License-Identifier: GPL-3.0-only
[run]
omit =
*/site-packages/*
test*.py
[report]
exclude_also =
def __repr__
if self.debug:
if settings.DEBUG
raise AssertionError
raise NotImplementedError
if 0:
if __name__ == .__main__.:
if TYPE_CHECKING:
class .*\bProtocol\):
@(abc\.)?abstractmethod

View file

@ -41,19 +41,13 @@ jobs:
- '3.13.0-alpha.0 - 3.13'
os-version:
- 'ubuntu-latest'
coverage-core:
- 'ctrace'
include:
- os-version: 'macos-latest'
python-version: '3.x'
- os-version: 'windows-latest'
python-version: '3.x'
- os-version: 'ubuntu-latest'
python-version: '3.12'
coverage-core: 'sysmon'
- os-version: 'ubuntu-latest'
python-version: 'pypy-3.10'
coverage-core: 'pytrace'
runs-on: ${{ matrix.os-version }}
steps:
@ -74,13 +68,13 @@ jobs:
run: make mypy PYTHON=python
- name: Test
run: make coverage PYTHON=python COVERAGE_CORE=${{ matrix.coverage-core }}
run: make coverage PYTHON=python
- name: Upload Coverage as artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage for ${{ matrix.python-version }} on ${{ matrix.os-version }} ${{ matrix.coverage-core }}
name: coverage for ${{ matrix.python-version }} on ${{ matrix.os-version }}
path: coverage.xml
pre-commit:

View file

@ -55,9 +55,6 @@ BUILDDIR = _build
html:
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
# Pass the desired coverage tracer name to subprocesses
export COVERAGE_CORE
# Copyright (C) 2021 Jeff Epler <jepler@gmail.com>
# SPDX-FileCopyrightText: 2021 Jeff Epler
#

View file

@ -17,7 +17,7 @@ from typing import TYPE_CHECKING, Any, NamedTuple, TextIO, TypeVar
from . import iersdata
from .tz import Mountain
if TYPE_CHECKING: # pragma: no cover
if TYPE_CHECKING:
from collections.abc import Generator
HOUR = datetime.timedelta(seconds=3600)

View file

@ -10,7 +10,7 @@ from typing import TYPE_CHECKING
import wwvb
if TYPE_CHECKING: # pragma: no cover
if TYPE_CHECKING:
from collections.abc import Generator
# State 1: Unsync'd
@ -89,5 +89,5 @@ def main() -> None:
print(w)
if __name__ == "__main__": # pragma no cover
if __name__ == "__main__":
main()

View file

@ -28,5 +28,5 @@ def main() -> None:
print(date)
if __name__ == "__main__": # pragma no branch
if __name__ == "__main__":
main()

View file

@ -124,5 +124,5 @@ def main(
print_timecodes(w, minutes, channel, style, all_timecodes=all_timecodes, file=sys.stdout)
if __name__ == "__main__": # pragma no branch
if __name__ == "__main__":
main()

View file

@ -17,12 +17,12 @@ from .iersdata_dist import DUT1_DATA_START, DUT1_OFFSETS
for location in [
platformdirs.user_data_dir("wwvbpy", "unpythonic.net"),
platformdirs.site_data_dir("wwvbpy", "unpythonic.net"),
]: # pragma no cover
]:
path = pathlib.Path(location) / "wwvbpy_iersdata.py"
if path.exists():
if path.exists(): # pragma no cover
exec(path.read_text(encoding="utf-8"), globals(), globals())
break
start = datetime.datetime.combine(DUT1_DATA_START, datetime.time()).replace(tzinfo=datetime.timezone.utc)
start = datetime.datetime.combine(DUT1_DATA_START, datetime.time(), tzinfo=datetime.timezone.utc)
span = datetime.timedelta(days=len(DUT1_OFFSETS))
end = start + span

View file

@ -53,9 +53,9 @@ class TestLeapSecond(unittest.TestCase):
leap.append(nm)
else:
assert not our_is_ls
d = datetime.datetime.combine(nm, datetime.time()).replace(tzinfo=datetime.timezone.utc)
d = datetime.datetime.combine(nm, datetime.time(), tzinfo=datetime.timezone.utc)
self.assertEqual(leap, bench)
if __name__ == "__main__": # pragma: no cover
if __name__ == "__main__":
unittest.main()

View file

@ -29,5 +29,5 @@ class TestPhaseModulation(unittest.TestCase):
self.assertEqual(ref_pm, test_pm)
if __name__ == "__main__": # pragma: no cover
if __name__ == "__main__":
unittest.main()

View file

@ -216,5 +216,5 @@ class WWVBRoundtrip(unittest.TestCase):
)
if __name__ == "__main__": # pragma no cover
if __name__ == "__main__":
unittest.main()

View file

@ -397,5 +397,5 @@ class WWVBRoundtrip(unittest.TestCase):
self.assertEqual(WWVBMinute2k(2099, 1, 1, 0, 0).year, 2099)
if __name__ == "__main__": # pragma no cover
if __name__ == "__main__":
unittest.main()