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

Add GitHub actions for linting and automated testing #1

Merged
merged 2 commits into from
Nov 29, 2023
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
25 changes: 25 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Lint
on:
push:
branches:
- master
pull_request:
merge_group:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: pip install black==22.12.0 isort==5.12.0 flake8==6.1.0
- name: Run black
run: black --check .
- name: Run isort
run: isort --diff --check .
- name: Run flake8
# E203: whitespace before ':', ignored by Black, non-PEP8-compliant
# E501: line too long, black'll take care of that
run: flake8 --max-line-length=88 --extend-ignore=E203,E501
27 changes: 27 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Test
on:
push:
branches:
- master
pull_request:
merge_group:
jobs:
unit:
runs-on: ubuntu-latest
services:
redis:
image: redis
ports:
- 6399:6379
strategy:
matrix:
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: pip install -r requirements-testing.txt
- name: Run tests
run: tox
2 changes: 1 addition & 1 deletion tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_init(self, celery_app):
Test that task initialization sets up the necessary attributes.
"""
task_instance = self._get_task_instance(celery_app)
assert task_instance._LockableTask__lock_key == f"tests.test_tasks.my_task_lock"
assert task_instance._LockableTask__lock_key == "tests.test_tasks.my_task_lock"
assert task_instance._LockableTask__lock is None

def test_standard_connection(self, celery_app):
Expand Down