From bf471d7dfcef58250ffc7971cca70a673d884c3b Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Fri, 12 Apr 2019 01:45:45 +0200 Subject: [PATCH] Allow test suite to run with pytest --- setup.cfg | 2 +- tests/unit/test_tag_analytical.py | 4 ++-- tests/unit/test_tag_chartbeat.py | 2 +- tests/unit/test_tag_clickmap.py | 2 +- tests/unit/test_tag_clicky.py | 2 +- tests/unit/test_tag_crazy_egg.py | 2 +- tests/unit/test_tag_facebook_pixel.py | 2 +- tests/unit/test_tag_gauges.py | 2 +- tests/unit/test_tag_google_analytics.py | 2 +- tests/unit/test_tag_google_analytics_gtag.py | 2 +- tests/unit/test_tag_google_analytics_js.py | 2 +- tests/unit/test_tag_gosquared.py | 2 +- tests/unit/test_tag_hotjar.py | 2 +- tests/unit/test_tag_hubspot.py | 2 +- tests/unit/test_tag_intercom.py | 2 +- tests/unit/test_tag_kiss_insights.py | 2 +- tests/unit/test_tag_kiss_metrics.py | 2 +- tests/unit/test_tag_matomo.py | 2 +- tests/unit/test_tag_mixpanel.py | 2 +- tests/unit/test_tag_olark.py | 2 +- tests/unit/test_tag_optimizely.py | 2 +- tests/unit/test_tag_performable.py | 2 +- tests/unit/test_tag_piwik.py | 2 +- tests/unit/test_tag_rating_mailru.py | 2 +- tests/unit/test_tag_snapengage.py | 2 +- tests/unit/test_tag_spring_metrics.py | 2 +- tests/unit/test_tag_uservoice.py | 2 +- tests/unit/test_tag_woopra.py | 2 +- tests/unit/test_tag_yandex_metrica.py | 2 +- tests/unit/test_utils.py | 6 +++++- 30 files changed, 35 insertions(+), 31 deletions(-) diff --git a/setup.cfg b/setup.cfg index f3c3b37..72285af 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,4 +7,4 @@ all_files = 1 upload-dir = build/docs/html [tool:pytest] -DJANGO_SETTINGS_MODULE = analytical.tests.settings +DJANGO_SETTINGS_MODULE = tests.testproject.settings diff --git a/tests/unit/test_tag_analytical.py b/tests/unit/test_tag_analytical.py index 1dcba80..81e7936 100644 --- a/tests/unit/test_tag_analytical.py +++ b/tests/unit/test_tag_analytical.py @@ -5,7 +5,7 @@ Tests for the generic template tags and filters. from django.template import Context, Template from analytical.templatetags import analytical -from analytical.tests.utils import TagTestCase +from utils import TagTestCase class AnalyticsTagTestCase(TagTestCase): @@ -16,7 +16,7 @@ class AnalyticsTagTestCase(TagTestCase): def setUp(self): super().setUp() self._tag_modules = analytical.TAG_MODULES - analytical.TAG_MODULES = ['analytical.tests.dummy'] + analytical.TAG_MODULES = ['tests.testproject.dummy'] analytical.template_nodes = analytical._load_template_nodes() def tearDown(self): diff --git a/tests/unit/test_tag_chartbeat.py b/tests/unit/test_tag_chartbeat.py index 67ebd10..c6f420c 100644 --- a/tests/unit/test_tag_chartbeat.py +++ b/tests/unit/test_tag_chartbeat.py @@ -11,7 +11,7 @@ from django.test.utils import override_settings from analytical.templatetags.chartbeat import ChartbeatTopNode, \ ChartbeatBottomNode -from analytical.tests.utils import TagTestCase +from utils import TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_tag_clickmap.py b/tests/unit/test_tag_clickmap.py index ed8656f..588a209 100644 --- a/tests/unit/test_tag_clickmap.py +++ b/tests/unit/test_tag_clickmap.py @@ -7,7 +7,7 @@ from django.template import Context from django.test.utils import override_settings from analytical.templatetags.clickmap import ClickmapNode -from analytical.tests.utils import TagTestCase +from utils import TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_tag_clicky.py b/tests/unit/test_tag_clicky.py index b2f2731..b830e57 100644 --- a/tests/unit/test_tag_clicky.py +++ b/tests/unit/test_tag_clicky.py @@ -10,7 +10,7 @@ from django.template import Context from django.test.utils import override_settings from analytical.templatetags.clicky import ClickyNode -from analytical.tests.utils import TagTestCase +from utils import TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_tag_crazy_egg.py b/tests/unit/test_tag_crazy_egg.py index 66e6d56..396591e 100644 --- a/tests/unit/test_tag_crazy_egg.py +++ b/tests/unit/test_tag_crazy_egg.py @@ -7,7 +7,7 @@ from django.template import Context from django.test.utils import override_settings from analytical.templatetags.crazy_egg import CrazyEggNode -from analytical.tests.utils import TagTestCase +from utils import TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_tag_facebook_pixel.py b/tests/unit/test_tag_facebook_pixel.py index e196ce9..1bbdfad 100644 --- a/tests/unit/test_tag_facebook_pixel.py +++ b/tests/unit/test_tag_facebook_pixel.py @@ -7,7 +7,7 @@ from django.test import override_settings from analytical.templatetags.analytical import _load_template_nodes from analytical.templatetags.facebook_pixel import FacebookPixelHeadNode, FacebookPixelBodyNode -from analytical.tests.utils import TagTestCase +from utils import TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_tag_gauges.py b/tests/unit/test_tag_gauges.py index 8d80b80..7eab19d 100644 --- a/tests/unit/test_tag_gauges.py +++ b/tests/unit/test_tag_gauges.py @@ -7,7 +7,7 @@ from django.template import Context from django.test.utils import override_settings from analytical.templatetags.gauges import GaugesNode -from analytical.tests.utils import TagTestCase +from utils import TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_tag_google_analytics.py b/tests/unit/test_tag_google_analytics.py index 67c8360..da73996 100644 --- a/tests/unit/test_tag_google_analytics.py +++ b/tests/unit/test_tag_google_analytics.py @@ -9,7 +9,7 @@ from django.test.utils import override_settings from analytical.templatetags.google_analytics import GoogleAnalyticsNode, \ TRACK_SINGLE_DOMAIN, TRACK_MULTIPLE_DOMAINS, TRACK_MULTIPLE_SUBDOMAINS,\ SCOPE_VISITOR, SCOPE_SESSION, SCOPE_PAGE -from analytical.tests.utils import TestCase, TagTestCase +from utils import TestCase, TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_tag_google_analytics_gtag.py b/tests/unit/test_tag_google_analytics_gtag.py index 1e5430c..c81368f 100644 --- a/tests/unit/test_tag_google_analytics_gtag.py +++ b/tests/unit/test_tag_google_analytics_gtag.py @@ -8,7 +8,7 @@ from django.template import Context from django.test.utils import override_settings from analytical.templatetags.google_analytics_gtag import GoogleAnalyticsGTagNode -from analytical.tests.utils import TagTestCase +from utils import TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_tag_google_analytics_js.py b/tests/unit/test_tag_google_analytics_js.py index 517eb8b..1009fbb 100644 --- a/tests/unit/test_tag_google_analytics_js.py +++ b/tests/unit/test_tag_google_analytics_js.py @@ -8,7 +8,7 @@ from django.test.utils import override_settings from analytical.templatetags.google_analytics_js import GoogleAnalyticsJsNode, \ TRACK_SINGLE_DOMAIN, TRACK_MULTIPLE_DOMAINS, TRACK_MULTIPLE_SUBDOMAINS -from analytical.tests.utils import TestCase, TagTestCase +from utils import TestCase, TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_tag_gosquared.py b/tests/unit/test_tag_gosquared.py index 844205c..444420f 100644 --- a/tests/unit/test_tag_gosquared.py +++ b/tests/unit/test_tag_gosquared.py @@ -8,7 +8,7 @@ from django.template import Context from django.test.utils import override_settings from analytical.templatetags.gosquared import GoSquaredNode -from analytical.tests.utils import TagTestCase +from utils import TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_tag_hotjar.py b/tests/unit/test_tag_hotjar.py index 6f285c2..d5978b8 100644 --- a/tests/unit/test_tag_hotjar.py +++ b/tests/unit/test_tag_hotjar.py @@ -7,7 +7,7 @@ from django.test import override_settings from analytical.templatetags.analytical import _load_template_nodes from analytical.templatetags.hotjar import HotjarNode -from analytical.tests.utils import TagTestCase +from utils import TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_tag_hubspot.py b/tests/unit/test_tag_hubspot.py index ee9d2ff..5678258 100644 --- a/tests/unit/test_tag_hubspot.py +++ b/tests/unit/test_tag_hubspot.py @@ -7,7 +7,7 @@ from django.template import Context from django.test.utils import override_settings from analytical.templatetags.hubspot import HubSpotNode -from analytical.tests.utils import TagTestCase +from utils import TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_tag_intercom.py b/tests/unit/test_tag_intercom.py index 03cc47f..be99ccc 100644 --- a/tests/unit/test_tag_intercom.py +++ b/tests/unit/test_tag_intercom.py @@ -10,7 +10,7 @@ from django.template import Context from django.test.utils import override_settings from analytical.templatetags.intercom import IntercomNode, intercom_user_hash -from analytical.tests.utils import TagTestCase +from utils import TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_tag_kiss_insights.py b/tests/unit/test_tag_kiss_insights.py index ffbba16..dc627d1 100644 --- a/tests/unit/test_tag_kiss_insights.py +++ b/tests/unit/test_tag_kiss_insights.py @@ -7,7 +7,7 @@ from django.template import Context from django.test.utils import override_settings from analytical.templatetags.kiss_insights import KissInsightsNode -from analytical.tests.utils import TagTestCase +from utils import TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_tag_kiss_metrics.py b/tests/unit/test_tag_kiss_metrics.py index 506b635..d3e885f 100644 --- a/tests/unit/test_tag_kiss_metrics.py +++ b/tests/unit/test_tag_kiss_metrics.py @@ -8,7 +8,7 @@ from django.template import Context from django.test.utils import override_settings from analytical.templatetags.kiss_metrics import KissMetricsNode -from analytical.tests.utils import TagTestCase +from utils import TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_tag_matomo.py b/tests/unit/test_tag_matomo.py index d3d6785..fc37614 100644 --- a/tests/unit/test_tag_matomo.py +++ b/tests/unit/test_tag_matomo.py @@ -8,7 +8,7 @@ from django.template import Context from django.test.utils import override_settings from analytical.templatetags.matomo import MatomoNode -from analytical.tests.utils import TagTestCase +from utils import TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_tag_mixpanel.py b/tests/unit/test_tag_mixpanel.py index 033c2c7..e432ea6 100644 --- a/tests/unit/test_tag_mixpanel.py +++ b/tests/unit/test_tag_mixpanel.py @@ -8,7 +8,7 @@ from django.template import Context from django.test.utils import override_settings from analytical.templatetags.mixpanel import MixpanelNode -from analytical.tests.utils import TagTestCase +from utils import TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_tag_olark.py b/tests/unit/test_tag_olark.py index 378bea7..a18fc89 100644 --- a/tests/unit/test_tag_olark.py +++ b/tests/unit/test_tag_olark.py @@ -7,7 +7,7 @@ from django.template import Context from django.test.utils import override_settings from analytical.templatetags.olark import OlarkNode -from analytical.tests.utils import TagTestCase +from utils import TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_tag_optimizely.py b/tests/unit/test_tag_optimizely.py index a1cce26..367f359 100644 --- a/tests/unit/test_tag_optimizely.py +++ b/tests/unit/test_tag_optimizely.py @@ -7,7 +7,7 @@ from django.template import Context from django.test.utils import override_settings from analytical.templatetags.optimizely import OptimizelyNode -from analytical.tests.utils import TagTestCase +from utils import TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_tag_performable.py b/tests/unit/test_tag_performable.py index 2b1e16d..24e20c8 100644 --- a/tests/unit/test_tag_performable.py +++ b/tests/unit/test_tag_performable.py @@ -8,7 +8,7 @@ from django.template import Context from django.test.utils import override_settings from analytical.templatetags.performable import PerformableNode -from analytical.tests.utils import TagTestCase +from utils import TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_tag_piwik.py b/tests/unit/test_tag_piwik.py index 32661ee..38aa317 100644 --- a/tests/unit/test_tag_piwik.py +++ b/tests/unit/test_tag_piwik.py @@ -8,7 +8,7 @@ from django.template import Context from django.test.utils import override_settings from analytical.templatetags.piwik import PiwikNode -from analytical.tests.utils import TagTestCase +from utils import TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_tag_rating_mailru.py b/tests/unit/test_tag_rating_mailru.py index 45d0309..d8f9459 100644 --- a/tests/unit/test_tag_rating_mailru.py +++ b/tests/unit/test_tag_rating_mailru.py @@ -7,7 +7,7 @@ from django.template import Context from django.test.utils import override_settings from analytical.templatetags.rating_mailru import RatingMailruNode -from analytical.tests.utils import TagTestCase +from utils import TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_tag_snapengage.py b/tests/unit/test_tag_snapengage.py index 02b37cc..215ebe2 100644 --- a/tests/unit/test_tag_snapengage.py +++ b/tests/unit/test_tag_snapengage.py @@ -11,7 +11,7 @@ from analytical.templatetags.snapengage import SnapEngageNode, \ BUTTON_STYLE_LIVE, BUTTON_STYLE_DEFAULT, BUTTON_STYLE_NONE, \ BUTTON_LOCATION_LEFT, BUTTON_LOCATION_RIGHT, BUTTON_LOCATION_TOP, \ BUTTON_LOCATION_BOTTOM, FORM_POSITION_TOP_LEFT -from analytical.tests.utils import TagTestCase +from utils import TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_tag_spring_metrics.py b/tests/unit/test_tag_spring_metrics.py index 14aeb3c..ca00e71 100644 --- a/tests/unit/test_tag_spring_metrics.py +++ b/tests/unit/test_tag_spring_metrics.py @@ -8,7 +8,7 @@ from django.template import Context from django.test.utils import override_settings from analytical.templatetags.spring_metrics import SpringMetricsNode -from analytical.tests.utils import TagTestCase +from utils import TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_tag_uservoice.py b/tests/unit/test_tag_uservoice.py index 9bce78d..c740311 100644 --- a/tests/unit/test_tag_uservoice.py +++ b/tests/unit/test_tag_uservoice.py @@ -6,7 +6,7 @@ from django.template import Context from django.test.utils import override_settings from analytical.templatetags.uservoice import UserVoiceNode -from analytical.tests.utils import TagTestCase +from utils import TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_tag_woopra.py b/tests/unit/test_tag_woopra.py index 671e7de..9dca7e9 100644 --- a/tests/unit/test_tag_woopra.py +++ b/tests/unit/test_tag_woopra.py @@ -8,7 +8,7 @@ from django.template import Context from django.test.utils import override_settings from analytical.templatetags.woopra import WoopraNode -from analytical.tests.utils import TagTestCase +from utils import TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_tag_yandex_metrica.py b/tests/unit/test_tag_yandex_metrica.py index fa287db..3b0619e 100644 --- a/tests/unit/test_tag_yandex_metrica.py +++ b/tests/unit/test_tag_yandex_metrica.py @@ -8,7 +8,7 @@ from django.template import Context from django.test.utils import override_settings from analytical.templatetags.yandex_metrica import YandexMetricaNode -from analytical.tests.utils import TagTestCase +from utils import TagTestCase from analytical.utils import AnalyticalException diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index 5a7bd1f..22b2a88 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -16,7 +16,7 @@ from analytical.utils import ( get_required_setting, is_internal_ip, ) -from analytical.tests.utils import TestCase +from utils import TestCase class SettingDeletedTestCase(TestCase): @@ -35,6 +35,10 @@ class MyUser(AbstractBaseUser): identity = models.CharField(max_length=50) USERNAME_FIELD = 'identity' + class Meta: + abstract = True + app_label = 'testapp' + class GetIdentityTestCase(TestCase): def test_custom_username_field(self):