Skip to content

Commit

Permalink
Freeze time to fix test (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk authored Apr 1, 2024
1 parent 0742939 commit 1b19244
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 41 deletions.
29 changes: 0 additions & 29 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,3 @@
# Default GitHub labels
- color: d73a4a
description: "Something isn't working"
name: bug
- color: cfd3d7
description: "This issue or pull request already exists"
name: duplicate
- color: a2eeef
description: "New feature or request"
name: enhancement
- color: 7057ff
description: "Good for newcomers"
name: good first issue
- color: 008672
description: "Extra attention is needed"
name: help wanted
- color: e4e669
description: "This doesn't seem right"
name: invalid
- color: d876e3
description: "Further information is requested"
name: question
- color: ffffff
description: "This will not be worked on"
name: wontfix

# Keep a Changelog labels
# https://keepachangelog.com/en/1.0.0/
- color: 0e8a16
Expand Down Expand Up @@ -52,9 +26,6 @@
- color: 0366d6
description: "For dependencies"
name: dependencies
- color: 0052cc
description: "Documentation"
name: docs
- color: f4660e
description: ""
name: Hacktoberfest
Expand Down
4 changes: 0 additions & 4 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
"groupName": "github-actions",
"matchManagers": ["github-actions"],
"separateMajorMinor": "false"
},
{
"groupName": "requirements.txt",
"matchPaths": ["requirements.txt"]
}
],
"schedule": ["on the first day of the month"]
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["pypy3.10", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
# Will be fixed in 3.13.0a6: Tuesday, 2024-04-09
# qs = bytes(qs)
# ~~~~~^^^^
# TypeError: cannot convert 'NoneType' object to bytes
python-version:
["pypy3.10", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13.0-alpha.4"]
os: [windows-latest, macos-latest, ubuntu-latest]

steps:
Expand All @@ -34,6 +39,10 @@ jobs:
run: |
tox -e py
- name: Test CLI
run: |
tox -e cli
- name: Tox tests (pins)
if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest'
run: |
Expand Down
14 changes: 11 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.1
rev: v0.3.4
hooks:
- id: ruff
args: [--exit-non-zero-on-fix]

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.2.0
rev: 24.3.0
hooks:
- id: black

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-json
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: forbid-submodules
- id: requirements-txt-fixer
- id: trailing-whitespace
exclude: tests/data/expected_output.py

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.28.1
hooks:
- id: check-github-workflows
- id: check-renovate

# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.7.0
# hooks:
Expand All @@ -36,10 +44,10 @@ repos:
# prettytable,
# pytablewriter,
# pytest,
# python-slugify,
# respx,
# termcolor,
# types-python-dateutil,
# types-python-slugify,
# ]

- repo: https://github.com/tox-dev/pyproject-fmt
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ name = "norwegianblue"
description = "CLI to show end-of-life dates for a number of products"
readme = "README.md"
keywords = [
"cli",
"end-of-life",
"endoflife",
"eol",
Expand Down
1 change: 1 addition & 0 deletions tests/test_norwegianblue.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def teardown_method(self) -> None:
_cache.filename = self.original__cache_filename
_cache.save = self.original__save_cache

@freeze_time("2023-11-23")
@mock.patch.dict(os.environ, {"NO_COLOR": "TRUE"})
@respx.mock
@pytest.mark.parametrize(
Expand Down
12 changes: 8 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ requires =
tox>=4.2
env_list =
cog
cli
lint
pins
py{py3, 313, 312, 311, 310, 39, 38}
Expand All @@ -18,10 +19,6 @@ commands =
--cov-report term \
--cov-report xml \
{posargs}
norwegianblue --version
norwegianblue --help
eol --version
eol --help

[testenv:cog]
skip_install = true
Expand All @@ -30,6 +27,13 @@ deps =
commands =
cog -Pr README.md

[testenv:cli]
commands =
norwegianblue --version
norwegianblue --help
eol --version
eol --help

[testenv:lint]
skip_install = true
deps =
Expand Down

0 comments on commit 1b19244

Please sign in to comment.