From 6aabe8ca80ff699c2c5a34b1c7636e99b960a79c Mon Sep 17 00:00:00 2001 From: Marcel Wilson Date: Sat, 17 Feb 2024 13:55:52 -0600 Subject: [PATCH] adding test for copyright in `__init__.py` --- tests/test__version__.py | 18 ------------------ tests/test_copyright.py | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 18 deletions(-) create mode 100644 tests/test_copyright.py diff --git a/tests/test__version__.py b/tests/test__version__.py index c6358c0..41540f4 100644 --- a/tests/test__version__.py +++ b/tests/test__version__.py @@ -1,8 +1,5 @@ from __future__ import annotations -from datetime import datetime -from pathlib import Path - from screenpy_selenium import __version__ @@ -10,18 +7,3 @@ def test_metadata() -> None: assert __version__.__title__ == "screenpy_selenium" assert __version__.__license__ == "MIT" assert __version__.__author__ == "Perry Goy" - - -def test_copyright_year() -> None: - current = datetime.now().year - - assert f"{current}" in __version__.__copyright__ - - -def test_copyright_year_in_license() -> None: - current = datetime.now().year - license_path = Path(__file__).parent / ".." / "LICENSE" - with open(license_path) as fp: - license_text = fp.read() - - assert f"{current}" in license_text diff --git a/tests/test_copyright.py b/tests/test_copyright.py new file mode 100644 index 0000000..f3b0784 --- /dev/null +++ b/tests/test_copyright.py @@ -0,0 +1,27 @@ +from __future__ import annotations + +from datetime import datetime +from pathlib import Path + +import pytest + +from screenpy_selenium import __doc__, __version__ + + +class TestCopyrightYear: + @pytest.fixture(autouse=True) + def _setup(self) -> None: + self.current_year = datetime.now().year + + def test_version(self) -> None: + assert f"{self.current_year}" in __version__.__copyright__ + + def test_license(self) -> None: + license_path = Path(__file__).parent / ".." / "LICENSE" + with open(license_path) as fp: + license_text = fp.read() + + assert f"{self.current_year}" in license_text + + def test_init(self) -> None: + assert f"{self.current_year}" in __doc__