Skip to content

Commit

Permalink
Don't pollute the celery queue while testing
Browse files Browse the repository at this point in the history
  • Loading branch information
aptiko committed Dec 5, 2024
1 parent c83d7b1 commit bcace54
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions enhydris/autoprocess/tests/test_apps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from unittest import mock

from django.contrib.gis.geos import Point
from django.db import transaction
from django.test import TransactionTestCase

Expand All @@ -16,8 +17,12 @@ class EnqueueAutoProcessTestCase(TransactionTestCase):
# without truncating enhydris_timeseriesrecord at the same time.
available_apps = ["django.contrib.sites", "enhydris", "enhydris.autoprocess"]

def setUp(self):
self.station = baker.make(Station)
# Creating autoprocesses triggers tasks, so we patch some things in order to not
# pollute the celery queue while testing.
@mock.patch("enhydris.autoprocess.models.tasks.execute_auto_process")
@mock.patch("enhydris.autoprocess.apps.execute_auto_process")
def setUp(self, m1, m2):
self.station = baker.make(Station, geom=Point(x=21.06, y=39.09, srid=4326))
self.auto_process = baker.make(
Checks,
timeseries_group__gentity=self.station,
Expand Down

0 comments on commit bcace54

Please sign in to comment.