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

Commit

Permalink
Add trackers (#11)
Browse files Browse the repository at this point in the history
* fix: improve query TrackerAPI perf. by 140x

* chore: exclude debug log

* ci: pytest and fix tests

* ci: test on ubuntu only

* chore: rename pytest CI
  • Loading branch information
AnsonDev42 authored Apr 20, 2024
1 parent 8c7abbe commit e9737d3
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 6 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/pytest-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
on:
push:
branches:
- "**"
pull_request:
branches:
- "**"
name: Pytest CI
concurrency:
group: check-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: test with ${{ matrix.py }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
services:
postgres:
image: postgres:12
env:
POSTGRES_USER: mydatabaseuser
POSTGRES_PASSWORD: mypassword
POSTGRES_DB: mydatabase
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
matrix:
py:
- "3.12.2"
os:
- ubuntu-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: Set environment variables
run: |
set -a
source .env.dev
set +a
env | grep -vE '^(_|PWD|HOME|GITHUB_)' >> $GITHUB_ENV
- 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 e9737d3

Please sign in to comment.