Skip to content

Commit

Permalink
Merge pull request #14 from hugovk/add-3.12
Browse files Browse the repository at this point in the history
Add Python 3.12 => PEP 693
  • Loading branch information
hugovk authored Jun 18, 2022
2 parents 31389d6 + e5f87e7 commit e9d0511
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
18 changes: 10 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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]
Expand Down Expand Up @@ -28,30 +28,32 @@ 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
hooks:
- 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]
Expand Down
1 change: 1 addition & 0 deletions src/pepotron/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"3.9": 596,
"3.10": 619,
"3.11": 664,
"3.12": 693,
}


Expand Down
18 changes: 9 additions & 9 deletions tests/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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")

Expand All @@ -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!")
Expand All @@ -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)
Expand All @@ -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"
Expand All @@ -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"
Expand Down

0 comments on commit e9d0511

Please sign in to comment.