Skip to content

Commit

Permalink
Run geocoding tests separately
Browse files Browse the repository at this point in the history
  • Loading branch information
janbaykara committed Dec 19, 2024
1 parent 38cb459 commit b0dbe26
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ jobs:
run: gunicorn local_intelligence_hub.asgi:application -k uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000 > server.log 2>&1 &
- name: Run django tests
run: cat .env && coverage run --source=. --branch manage.py test || (cat server.log && exit 1)
- name: Run geocoding tests in isolation
run: RUN_GEOCODING_TESTS=1 manage.py test hub.tests.test_external_data_source_parsers || (cat server.log && exit 1)
- name: Generate coverage xml
run: coverage xml
- name: Upload coverage.xml
Expand Down
9 changes: 5 additions & 4 deletions hub/tests/test_external_data_source_parsers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import os
import subprocess
from datetime import datetime, timezone
from unittest import skipIf
Expand All @@ -12,7 +13,7 @@
from hub.validation import validate_and_format_phone_number
from utils import mapit_types

ignore_geocoding_tests = False
ignore_geocoding_tests = os.getenv("RUN_GEOCODING_TESTS") != "1"


class TestDateFieldParer(TestCase):
Expand Down Expand Up @@ -107,7 +108,7 @@ def test_valid_phone_number_for_usa(self):
self.assertEqual(result, "+14155552671")


# @skipIf(ignore_geocoding_tests, "It messes up data for other tests.")
@skipIf(ignore_geocoding_tests, "It messes up data for other tests.")
class TestMultiLevelGeocoding(TestCase):
fixture = geocoding_cases

Expand Down Expand Up @@ -301,7 +302,7 @@ def test_skipping(self):
raise


# @skipIf(ignore_geocoding_tests, "It messes up data for other tests.")
@skipIf(ignore_geocoding_tests, "It messes up data for other tests.")
class TestComplexAddressGeocoding(TestCase):
@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -409,7 +410,7 @@ def test_skipping(self):
raise


# @skipIf(ignore_geocoding_tests, "It messes up data for other tests.")
@skipIf(ignore_geocoding_tests, "It messes up data for other tests.")
class TestCoordinateGeocoding(TestCase):
@classmethod
def setUpTestData(cls):
Expand Down

0 comments on commit b0dbe26

Please sign in to comment.