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

Fix failing tests introduced with #202 #204

Merged
merged 1 commit into from
Jan 2, 2022
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
11 changes: 4 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: push
jobs:
test:
name: Code check and tests
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v2
Expand All @@ -12,17 +12,14 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.8
python-version: '3.10'
- name: Install pipenv
run: pip install pipenv
- name: Check code formatting
uses: pre-commit/action@v2.0.3
- name: Prepare docker-compose override file
run: |
ln -s docker-compose.override.local.yml docker-compose.override.yml
- name: Check code formatting
run: |
pipenv install pre_commit
pipenv install pyyaml
pipenv run python -m pre_commit run --all-files
- name: Export the env variables file
run: |
cp .env.example .env
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ repos:

# Sort imports
- repo: https://github.com/pycqa/isort
rev: "5.7.0"
rev: "5.10.1"
hooks:
- id: isort
args: ["--profile", "black"]
Expand Down
7 changes: 7 additions & 0 deletions docker-app/qfieldcloud/core/management/commands/dequeue.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import signal
from time import sleep

from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.core.management.base import BaseCommand
from django.db import transaction
from django.db.models import Count, Q
Expand Down Expand Up @@ -41,6 +43,11 @@ def handle(self, *args, **options):

while killer.alive:
with use_test_db_if_exists():
# the worker wrapper caches outdated ContentType ids during tests since it runs in a separate
# container than the tests, which then the tests.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence sounds like it has grammar issues.

if settings.DATABASES["default"]["NAME"].startswith("test_"):
ContentType.objects.clear_cache()

queued_job = None

with transaction.atomic():
Expand Down