diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index be87421..703337b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -24,7 +24,7 @@ jobs: with: python-version: "3.10" cache: pip - cache-dependency-path: "setup.py" + cache-dependency-path: setup.cfg - name: Install dependencies run: | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f3bc60e..4b33984 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/asottile/pyupgrade - rev: v2.31.1 + rev: v2.34.0 hooks: - id: pyupgrade args: [--py37-plus] @@ -28,16 +28,13 @@ repos: - id: python-check-blanket-noqa - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.1.0 + rev: v4.3.0 hooks: - id: check-merge-conflict - id: check-toml - id: check-yaml - - - repo: https://github.com/tox-dev/pyproject-fmt - rev: 0.3.3 - hooks: - - id: pyproject-fmt + - id: end-of-file-fixer + - id: trailing-whitespace - repo: https://github.com/asottile/setup-cfg-fmt rev: v1.20.1 @@ -45,13 +42,18 @@ repos: - id: setup-cfg-fmt args: [--max-py-version=3.11] + - repo: https://github.com/tox-dev/pyproject-fmt + rev: 0.3.3 + hooks: + - id: pyproject-fmt + - repo: https://github.com/tox-dev/tox-ini-fmt rev: 0.5.2 hooks: - id: tox-ini-fmt - repo: https://github.com/pre-commit/mirrors-prettier - rev: v2.6.2 + rev: v2.7.1 hooks: - id: prettier args: [--prose-wrap=always, --print-width=88] diff --git a/src/pepotron/__init__.py b/src/pepotron/__init__.py index 431a506..ae64f19 100644 --- a/src/pepotron/__init__.py +++ b/src/pepotron/__init__.py @@ -44,6 +44,7 @@ "3.9": 596, "3.10": 619, "3.11": 664, + "3.12": 693, } diff --git a/tests/test_cache.py b/tests/test_cache.py index c4dfacf..b5dbfb0 100644 --- a/tests/test_cache.py +++ b/tests/test_cache.py @@ -10,18 +10,18 @@ class TestCache: - def setup_method(self): + def setup_method(self) -> None: # Choose a new cache dir that doesn't exist self.original_cache_dir = _cache.CACHE_DIR self.temp_dir = tempfile.TemporaryDirectory() _cache.CACHE_DIR = Path(self.temp_dir.name) / "pepotron" - def teardown_method(self): + def teardown_method(self) -> None: # Reset original _cache.CACHE_DIR = self.original_cache_dir @freeze_time("2018-12-26") - def test__cache_filename(self): + def test__cache_filename(self) -> None: # Arrange url = "https://peps.python.org/api/peps.json" @@ -31,7 +31,7 @@ def test__cache_filename(self): # Assert assert str(out).endswith("2018-12-26-https-peps-python-org-api-peps-json.json") - def test__load_cache_not_exist(self): + def test__load_cache_not_exist(self) -> None: # Arrange filename = Path("file-does-not-exist") @@ -41,7 +41,7 @@ def test__load_cache_not_exist(self): # Assert assert data == {} - def test__load_cache_bad_data(self): + def test__load_cache_bad_data(self) -> None: # Arrange with tempfile.NamedTemporaryFile(delete=False) as f: f.write(b"Invalid JSON!") @@ -52,10 +52,10 @@ def test__load_cache_bad_data(self): # Assert assert data == {} - def test_cache_round_trip(self): + def test_cache_round_trip(self) -> None: # Arrange filename = _cache.CACHE_DIR / "test_cache_round_trip.json" - data = {"1": "test data"} + data = {"1": {"authors": "bob"}} # Act _cache.save(filename, data) @@ -68,7 +68,7 @@ def test_cache_round_trip(self): assert new_data == data @freeze_time("2021-10-25") - def test__clear_cache_all(self): + def test__clear_cache_all(self) -> None: # Arrange # Create old cache file cache_file_old = _cache.CACHE_DIR / "2021-10-24-old-cache-file.json" @@ -86,7 +86,7 @@ def test__clear_cache_all(self): assert not cache_file_new.exists() @freeze_time("2021-10-25") - def test__clear_cache_old(self): + def test__clear_cache_old(self) -> None: # Arrange # Create old cache file cache_file_old = _cache.CACHE_DIR / "2021-10-24-old-cache-file.json"