Skip to content

Commit

Permalink
run tests in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
pi-sigma committed Jun 22, 2023
1 parent 4aeadaa commit 7ae603e
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 9 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,13 @@ jobs:
- name: Run tests
run: |
python src/manage.py collectstatic --noinput --link
coverage run src/manage.py test src
coverage run --concurrency=multiprocessing src/manage.py test src \
--parallel \
--exclude-tag no-parallel
coverage run src/manage.py test src --tag no-parallel
coverage combine
coverage report
env:
DJANGO_SETTINGS_MODULE: open_inwoner.conf.ci
SECRET_KEY: dummy
Expand Down
3 changes: 2 additions & 1 deletion src/open_inwoner/accounts/tests/test_action_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from django.contrib.messages import get_messages
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import override_settings
from django.test import override_settings, tag
from django.urls import reverse
from django.utils.translation import gettext as _

Expand Down Expand Up @@ -304,6 +304,7 @@ def test_action_status_not_your_action(self):
self.assertEqual(response.status_code, 404)


@tag("no-parallel")
@multi_browser()
@override_settings(ROOT_URLCONF="open_inwoner.cms.tests.urls")
class ActionsPlaywrightTests(PlaywrightSyncLiveServerTestCase):
Expand Down
3 changes: 2 additions & 1 deletion src/open_inwoner/accounts/tests/test_inbox_page.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from unittest import skip

from django.test import override_settings
from django.test import override_settings, tag
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _

Expand Down Expand Up @@ -234,6 +234,7 @@ def test_file_cannot_be_uploaded_when_sharing_disabled(self):
)


@tag("no-parallel")
@multi_browser()
@override_settings(ROOT_URLCONF="open_inwoner.cms.tests.urls")
class InboxPagePlaywrightTests(PlaywrightSyncLiveServerTestCase):
Expand Down
3 changes: 2 additions & 1 deletion src/open_inwoner/cms/cases/tests/test_htmx.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.test import override_settings
from django.test import override_settings, tag
from django.utils.translation import gettext as _

import requests_mock
Expand Down Expand Up @@ -37,6 +37,7 @@
)


@tag("no-parallel")
@requests_mock.Mocker()
@multi_browser()
@override_settings(ROOT_URLCONF="open_inwoner.cms.tests.urls")
Expand Down
5 changes: 4 additions & 1 deletion src/open_inwoner/plans/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from django.contrib.messages import get_messages
from django.core import mail
from django.test import override_settings
from django.test import override_settings, tag
from django.urls import reverse
from django.utils.translation import ugettext as _

Expand Down Expand Up @@ -1140,6 +1140,9 @@ def test_plan_contact_new_count(self):
self.assertEqual(len(links), 1)


tag("no-parallel")


@multi_browser()
@override_settings(ROOT_URLCONF="open_inwoner.cms.tests.urls")
class PlanActionStatusPlaywrightTests(ActionsPlaywrightTests):
Expand Down
2 changes: 2 additions & 0 deletions src/open_inwoner/search/tests/test_feedback.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import urllib

from django.contrib import messages
from django.test import tag
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _

Expand All @@ -15,6 +16,7 @@
from .utils import ESMixin


@tag("no-parallel")
class TestFeedbackFunctionality(ESMixin, WebTest):
def setUp(self):
self.user = UserFactory()
Expand Down
2 changes: 2 additions & 0 deletions src/open_inwoner/search/tests/test_logging.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.test import tag
from django.urls import reverse
from django.utils.translation import gettext as _

Expand All @@ -11,6 +12,7 @@
from .utils import ESMixin


@tag("no-parallel")
@freeze_time("2021-10-18 13:00:00")
class TestLogging(ESMixin, WebTest):
def test_search_query_of_logged_in_user_is_logged(self):
Expand Down
3 changes: 2 additions & 1 deletion src/open_inwoner/search/tests/test_page.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.test import override_settings
from django.test import override_settings, tag
from django.urls import reverse_lazy

from django_webtest import WebTest
Expand All @@ -14,6 +14,7 @@
from .utils import ESMixin


@tag("no-parallel")
@override_settings(ROOT_URLCONF="open_inwoner.cms.tests.urls")
class SearchPageTests(ESMixin, WebTest):
url = reverse_lazy("search:search")
Expand Down
3 changes: 2 additions & 1 deletion src/open_inwoner/search/tests/test_search_autocomplete.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from django.test import TestCase
from django.test import TestCase, tag

from open_inwoner.pdc.tests.factories import ProductFactory

from ..searches import search_autocomplete
from .utils import ESMixin


@tag("no-parallel")
class AutocompleteTests(ESMixin, TestCase):
def test_autocomplete_on_name(self):
ProductFactory.create(name="Name", keywords=["Keyword"])
Expand Down
4 changes: 3 additions & 1 deletion src/open_inwoner/search/tests/test_search_products.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.test import TestCase
from django.test import TestCase, tag

from open_inwoner.pdc.tests.factories import (
CategoryFactory,
Expand All @@ -13,6 +13,7 @@
from .utils import ESMixin


@tag("no-parallel")
class SearchQueryTests(ESMixin, TestCase):
def setUp(self):
super().setUp()
Expand Down Expand Up @@ -83,6 +84,7 @@ def test_search_product_with_typo(self):
self.assertEqual(int(results[0].meta.id), self.product1.id)


@tag("no-parallel")
class SearchFacetTests(ESMixin, TestCase):
def setUp(self):
super().setUp()
Expand Down
3 changes: 2 additions & 1 deletion src/open_inwoner/search/tests/test_search_products_boost.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.test import TestCase
from django.test import TestCase, tag

from open_inwoner.pdc.tests.factories import ProductFactory

Expand All @@ -7,6 +7,7 @@
from .utils import ESMixin


@tag("no-parallel")
class SearchBoostTests(ESMixin, TestCase):
def setUp(self):
super().setUp()
Expand Down

0 comments on commit 7ae603e

Please sign in to comment.