Skip to content
This repository was archived by the owner on Feb 1, 2025. It is now read-only.

Commit

Permalink
ci: pytest and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AnsonDev42 committed Apr 20, 2024
1 parent 7a56d8d commit 60ddf80
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 6 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/pytest-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
on:
push:
branches:
- "**"
pull_request:
branches:
- "**"
name: Run tests
concurrency:
group: check-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: test with ${{ matrix.py }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
py:
- "3.12.1"
- "3.12.3"
os:
- ubuntu-latest
- macos-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup python for test ${{ matrix.py }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.py }}
- name: Install poetry
run: |
python -m pip install poetry
poetry install
- name: Run tests
run: poetry run pytest -vv
20 changes: 19 additions & 1 deletion poetry.lock

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

7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ readme = "README.md"
python = "^3.12"
django = "^5.0.2"
psycopg = "^3.1.18"
httpx = {extras = ["http2"], version = "^0.27.0"}
httpx = { extras = ["http2"], version = "^0.27.0" }
pydantic = "^2.6.2"
celery = "^5.3.6"
djangorestframework = "^3.14.0"
Expand All @@ -23,12 +23,11 @@ python-dotenv = "^1.0.1"
dj-rest-auth = "^5.0.2"
pytest = "^8.0.2"
pytest-django = "^4.8.0"
pytest-asyncio = "^0.23.6"



[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.pytest.ini_options]
DJANGO_SETTINGS_MODULE = "uptimemonitor.settings"
asyncio_mode = "auto"
2 changes: 1 addition & 1 deletion test/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def test_create_service_with_periodic_task_data(periodic_task_data):
assert serializer.is_valid(), serializer.errors
service = serializer.save()
assert service.periodic_task is not None
assert service.periodic_task.name == "Test Task"
assert data["name"] in service.periodic_task.name
assert (
service.periodic_task.interval.every == 10
), service.periodic_task.interval.every
Expand Down

0 comments on commit 60ddf80

Please sign in to comment.