Skip to content

Commit

Permalink
adding test for copyright in __init__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
bandophahita committed Feb 17, 2024
1 parent 19b4df4 commit f4c47b1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 18 deletions.
18 changes: 0 additions & 18 deletions tests/test__version__.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,9 @@
from __future__ import annotations

from datetime import datetime
from pathlib import Path

from screenpy_playwright import __version__


def test_metadata() -> None:
assert __version__.__title__ == "screenpy_playwright"
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
27 changes: 27 additions & 0 deletions tests/test_copyright.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from __future__ import annotations

from datetime import datetime
from pathlib import Path

import pytest

from screenpy_playwright 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__

0 comments on commit f4c47b1

Please sign in to comment.