Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Fix warnings in GH actions, tests #88

Merged
merged 4 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
steps:
- name: Release
id: release
uses: google-github-actions/release-please-action@v3
uses: googleapis/release-please-action@v4
with:
release-type: python
package-name: judoscale
Expand All @@ -28,23 +28,23 @@ jobs:
if: ${{ needs.release-please.outputs.release_created == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Python
id: setup-python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.9

- name: Cache Poetry install
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.local
# NB! Update key when Poetry version is updated
key: python-${{ steps.setup-python.outputs.python-version }}-poetry-1.2.2

- name: Install Poetry
uses: snok/install-poetry@v1.3.3
uses: snok/install-poetry@v1
with:
# NB! Update Poetry cache key when updating Poetry version
version: 1.2.2
Expand All @@ -53,7 +53,7 @@ jobs:

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ jobs:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Cache Poetry install
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.local
# NB! Update key when Poetry version is updated
key: python-${{ steps.setup-python.outputs.python-version }}-poetry-1.2.2

- name: Install Poetry
uses: snok/install-poetry@v1.3.3
uses: snok/install-poetry@v1
with:
# NB! Update Poetry cache key when updating Poetry version
version: 1.2.2
Expand All @@ -34,7 +34,7 @@ jobs:

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
Expand Down
43 changes: 12 additions & 31 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 3 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description = "Official Python adapter for Judoscale — the advanced autoscaler
authors = [
"Adam McCrea <adam@adamlogic.com>",
"Mara <mara@multiplace.org>",
"Karl Sutt <karl@sutt.ee>"
"Karl Sutt <karl@sutt.ee>",
]
license = "MIT"
readme = "README.md"
Expand All @@ -16,7 +16,7 @@ classifiers = [
"Operating System :: OS Independent",
]

packages = [{include = "judoscale"}]
packages = [{ include = "judoscale" }]

[tool.poetry.dependencies]
python = "^3.8"
Expand All @@ -30,7 +30,7 @@ rq = { version = ">=1.0.0,<2.0.0", optional = true }
black = "^22.12.0"
isort = "^5.11.2"
flake8 = { version = "^6.0.0", python = ">=3.8.1,<4.0.0" }
pytest = "^7.2.2"
pytest = "^8.2.2"

[tool.poetry.extras]
django = ["django"]
Expand All @@ -42,11 +42,6 @@ rq = ["rq"]
[tool.isort]
profile = "black"

[tool.pytest.ini_options]
filterwarnings = [
"ignore:SelectableGroups dict interface is deprecated:DeprecationWarning"
]

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
8 changes: 5 additions & 3 deletions tests/test_collectors.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json
import time
from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone
from typing import List
from unittest.mock import Mock

Expand Down Expand Up @@ -359,7 +359,8 @@ def test_collect(self, worker_1):
redis.hgetall.return_value = {
# Simulate a job that was enqueued 1 minute ago
b"enqueued_at": rq_utils.utcformat(
datetime.utcnow() - timedelta(minutes=1)
datetime.now(tz=timezone.utc).replace(tzinfo=None)
- timedelta(minutes=1)
).encode(),
# Job origin has to match the queue name
b"origin": b"foo",
Expand All @@ -381,7 +382,8 @@ def test_collect_with_busy_job_tracking(self, worker_1, monkeypatch):
redis.hgetall.return_value = {
# Simulate a job that was enqueued 1 minute ago
b"enqueued_at": rq_utils.utcformat(
datetime.utcnow() - timedelta(minutes=1)
datetime.now(tz=timezone.utc).replace(tzinfo=None)
- timedelta(minutes=1)
).encode(),
# Job origin has to match the queue name
b"origin": b"foo",
Expand Down