Allow test suite to run with pytest

This commit is contained in:
Peter Bittner 2019-04-12 01:45:45 +02:00
parent a9d7d17ce6
commit bf471d7dfc
30 changed files with 35 additions and 31 deletions

View file

@ -7,4 +7,4 @@ all_files = 1
upload-dir = build/docs/html upload-dir = build/docs/html
[tool:pytest] [tool:pytest]
DJANGO_SETTINGS_MODULE = analytical.tests.settings DJANGO_SETTINGS_MODULE = tests.testproject.settings

View file

@ -5,7 +5,7 @@ Tests for the generic template tags and filters.
from django.template import Context, Template from django.template import Context, Template
from analytical.templatetags import analytical from analytical.templatetags import analytical
from analytical.tests.utils import TagTestCase from utils import TagTestCase
class AnalyticsTagTestCase(TagTestCase): class AnalyticsTagTestCase(TagTestCase):
@ -16,7 +16,7 @@ class AnalyticsTagTestCase(TagTestCase):
def setUp(self): def setUp(self):
super().setUp() super().setUp()
self._tag_modules = analytical.TAG_MODULES 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() analytical.template_nodes = analytical._load_template_nodes()
def tearDown(self): def tearDown(self):

View file

@ -11,7 +11,7 @@ from django.test.utils import override_settings
from analytical.templatetags.chartbeat import ChartbeatTopNode, \ from analytical.templatetags.chartbeat import ChartbeatTopNode, \
ChartbeatBottomNode ChartbeatBottomNode
from analytical.tests.utils import TagTestCase from utils import TagTestCase
from analytical.utils import AnalyticalException from analytical.utils import AnalyticalException

View file

@ -7,7 +7,7 @@ from django.template import Context
from django.test.utils import override_settings from django.test.utils import override_settings
from analytical.templatetags.clickmap import ClickmapNode from analytical.templatetags.clickmap import ClickmapNode
from analytical.tests.utils import TagTestCase from utils import TagTestCase
from analytical.utils import AnalyticalException from analytical.utils import AnalyticalException

View file

@ -10,7 +10,7 @@ from django.template import Context
from django.test.utils import override_settings from django.test.utils import override_settings
from analytical.templatetags.clicky import ClickyNode from analytical.templatetags.clicky import ClickyNode
from analytical.tests.utils import TagTestCase from utils import TagTestCase
from analytical.utils import AnalyticalException from analytical.utils import AnalyticalException

View file

@ -7,7 +7,7 @@ from django.template import Context
from django.test.utils import override_settings from django.test.utils import override_settings
from analytical.templatetags.crazy_egg import CrazyEggNode from analytical.templatetags.crazy_egg import CrazyEggNode
from analytical.tests.utils import TagTestCase from utils import TagTestCase
from analytical.utils import AnalyticalException from analytical.utils import AnalyticalException

View file

@ -7,7 +7,7 @@ from django.test import override_settings
from analytical.templatetags.analytical import _load_template_nodes from analytical.templatetags.analytical import _load_template_nodes
from analytical.templatetags.facebook_pixel import FacebookPixelHeadNode, FacebookPixelBodyNode from analytical.templatetags.facebook_pixel import FacebookPixelHeadNode, FacebookPixelBodyNode
from analytical.tests.utils import TagTestCase from utils import TagTestCase
from analytical.utils import AnalyticalException from analytical.utils import AnalyticalException

View file

@ -7,7 +7,7 @@ from django.template import Context
from django.test.utils import override_settings from django.test.utils import override_settings
from analytical.templatetags.gauges import GaugesNode from analytical.templatetags.gauges import GaugesNode
from analytical.tests.utils import TagTestCase from utils import TagTestCase
from analytical.utils import AnalyticalException from analytical.utils import AnalyticalException

View file

@ -9,7 +9,7 @@ from django.test.utils import override_settings
from analytical.templatetags.google_analytics import GoogleAnalyticsNode, \ from analytical.templatetags.google_analytics import GoogleAnalyticsNode, \
TRACK_SINGLE_DOMAIN, TRACK_MULTIPLE_DOMAINS, TRACK_MULTIPLE_SUBDOMAINS,\ TRACK_SINGLE_DOMAIN, TRACK_MULTIPLE_DOMAINS, TRACK_MULTIPLE_SUBDOMAINS,\
SCOPE_VISITOR, SCOPE_SESSION, SCOPE_PAGE SCOPE_VISITOR, SCOPE_SESSION, SCOPE_PAGE
from analytical.tests.utils import TestCase, TagTestCase from utils import TestCase, TagTestCase
from analytical.utils import AnalyticalException from analytical.utils import AnalyticalException

View file

@ -8,7 +8,7 @@ from django.template import Context
from django.test.utils import override_settings from django.test.utils import override_settings
from analytical.templatetags.google_analytics_gtag import GoogleAnalyticsGTagNode from analytical.templatetags.google_analytics_gtag import GoogleAnalyticsGTagNode
from analytical.tests.utils import TagTestCase from utils import TagTestCase
from analytical.utils import AnalyticalException from analytical.utils import AnalyticalException

View file

@ -8,7 +8,7 @@ from django.test.utils import override_settings
from analytical.templatetags.google_analytics_js import GoogleAnalyticsJsNode, \ from analytical.templatetags.google_analytics_js import GoogleAnalyticsJsNode, \
TRACK_SINGLE_DOMAIN, TRACK_MULTIPLE_DOMAINS, TRACK_MULTIPLE_SUBDOMAINS 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 from analytical.utils import AnalyticalException

View file

@ -8,7 +8,7 @@ from django.template import Context
from django.test.utils import override_settings from django.test.utils import override_settings
from analytical.templatetags.gosquared import GoSquaredNode from analytical.templatetags.gosquared import GoSquaredNode
from analytical.tests.utils import TagTestCase from utils import TagTestCase
from analytical.utils import AnalyticalException from analytical.utils import AnalyticalException

View file

@ -7,7 +7,7 @@ from django.test import override_settings
from analytical.templatetags.analytical import _load_template_nodes from analytical.templatetags.analytical import _load_template_nodes
from analytical.templatetags.hotjar import HotjarNode from analytical.templatetags.hotjar import HotjarNode
from analytical.tests.utils import TagTestCase from utils import TagTestCase
from analytical.utils import AnalyticalException from analytical.utils import AnalyticalException

View file

@ -7,7 +7,7 @@ from django.template import Context
from django.test.utils import override_settings from django.test.utils import override_settings
from analytical.templatetags.hubspot import HubSpotNode from analytical.templatetags.hubspot import HubSpotNode
from analytical.tests.utils import TagTestCase from utils import TagTestCase
from analytical.utils import AnalyticalException from analytical.utils import AnalyticalException

View file

@ -10,7 +10,7 @@ from django.template import Context
from django.test.utils import override_settings from django.test.utils import override_settings
from analytical.templatetags.intercom import IntercomNode, intercom_user_hash from analytical.templatetags.intercom import IntercomNode, intercom_user_hash
from analytical.tests.utils import TagTestCase from utils import TagTestCase
from analytical.utils import AnalyticalException from analytical.utils import AnalyticalException

View file

@ -7,7 +7,7 @@ from django.template import Context
from django.test.utils import override_settings from django.test.utils import override_settings
from analytical.templatetags.kiss_insights import KissInsightsNode from analytical.templatetags.kiss_insights import KissInsightsNode
from analytical.tests.utils import TagTestCase from utils import TagTestCase
from analytical.utils import AnalyticalException from analytical.utils import AnalyticalException

View file

@ -8,7 +8,7 @@ from django.template import Context
from django.test.utils import override_settings from django.test.utils import override_settings
from analytical.templatetags.kiss_metrics import KissMetricsNode from analytical.templatetags.kiss_metrics import KissMetricsNode
from analytical.tests.utils import TagTestCase from utils import TagTestCase
from analytical.utils import AnalyticalException from analytical.utils import AnalyticalException

View file

@ -8,7 +8,7 @@ from django.template import Context
from django.test.utils import override_settings from django.test.utils import override_settings
from analytical.templatetags.matomo import MatomoNode from analytical.templatetags.matomo import MatomoNode
from analytical.tests.utils import TagTestCase from utils import TagTestCase
from analytical.utils import AnalyticalException from analytical.utils import AnalyticalException

View file

@ -8,7 +8,7 @@ from django.template import Context
from django.test.utils import override_settings from django.test.utils import override_settings
from analytical.templatetags.mixpanel import MixpanelNode from analytical.templatetags.mixpanel import MixpanelNode
from analytical.tests.utils import TagTestCase from utils import TagTestCase
from analytical.utils import AnalyticalException from analytical.utils import AnalyticalException

View file

@ -7,7 +7,7 @@ from django.template import Context
from django.test.utils import override_settings from django.test.utils import override_settings
from analytical.templatetags.olark import OlarkNode from analytical.templatetags.olark import OlarkNode
from analytical.tests.utils import TagTestCase from utils import TagTestCase
from analytical.utils import AnalyticalException from analytical.utils import AnalyticalException

View file

@ -7,7 +7,7 @@ from django.template import Context
from django.test.utils import override_settings from django.test.utils import override_settings
from analytical.templatetags.optimizely import OptimizelyNode from analytical.templatetags.optimizely import OptimizelyNode
from analytical.tests.utils import TagTestCase from utils import TagTestCase
from analytical.utils import AnalyticalException from analytical.utils import AnalyticalException

View file

@ -8,7 +8,7 @@ from django.template import Context
from django.test.utils import override_settings from django.test.utils import override_settings
from analytical.templatetags.performable import PerformableNode from analytical.templatetags.performable import PerformableNode
from analytical.tests.utils import TagTestCase from utils import TagTestCase
from analytical.utils import AnalyticalException from analytical.utils import AnalyticalException

View file

@ -8,7 +8,7 @@ from django.template import Context
from django.test.utils import override_settings from django.test.utils import override_settings
from analytical.templatetags.piwik import PiwikNode from analytical.templatetags.piwik import PiwikNode
from analytical.tests.utils import TagTestCase from utils import TagTestCase
from analytical.utils import AnalyticalException from analytical.utils import AnalyticalException

View file

@ -7,7 +7,7 @@ from django.template import Context
from django.test.utils import override_settings from django.test.utils import override_settings
from analytical.templatetags.rating_mailru import RatingMailruNode from analytical.templatetags.rating_mailru import RatingMailruNode
from analytical.tests.utils import TagTestCase from utils import TagTestCase
from analytical.utils import AnalyticalException from analytical.utils import AnalyticalException

View file

@ -11,7 +11,7 @@ from analytical.templatetags.snapengage import SnapEngageNode, \
BUTTON_STYLE_LIVE, BUTTON_STYLE_DEFAULT, BUTTON_STYLE_NONE, \ BUTTON_STYLE_LIVE, BUTTON_STYLE_DEFAULT, BUTTON_STYLE_NONE, \
BUTTON_LOCATION_LEFT, BUTTON_LOCATION_RIGHT, BUTTON_LOCATION_TOP, \ BUTTON_LOCATION_LEFT, BUTTON_LOCATION_RIGHT, BUTTON_LOCATION_TOP, \
BUTTON_LOCATION_BOTTOM, FORM_POSITION_TOP_LEFT BUTTON_LOCATION_BOTTOM, FORM_POSITION_TOP_LEFT
from analytical.tests.utils import TagTestCase from utils import TagTestCase
from analytical.utils import AnalyticalException from analytical.utils import AnalyticalException

View file

@ -8,7 +8,7 @@ from django.template import Context
from django.test.utils import override_settings from django.test.utils import override_settings
from analytical.templatetags.spring_metrics import SpringMetricsNode from analytical.templatetags.spring_metrics import SpringMetricsNode
from analytical.tests.utils import TagTestCase from utils import TagTestCase
from analytical.utils import AnalyticalException from analytical.utils import AnalyticalException

View file

@ -6,7 +6,7 @@ from django.template import Context
from django.test.utils import override_settings from django.test.utils import override_settings
from analytical.templatetags.uservoice import UserVoiceNode from analytical.templatetags.uservoice import UserVoiceNode
from analytical.tests.utils import TagTestCase from utils import TagTestCase
from analytical.utils import AnalyticalException from analytical.utils import AnalyticalException

View file

@ -8,7 +8,7 @@ from django.template import Context
from django.test.utils import override_settings from django.test.utils import override_settings
from analytical.templatetags.woopra import WoopraNode from analytical.templatetags.woopra import WoopraNode
from analytical.tests.utils import TagTestCase from utils import TagTestCase
from analytical.utils import AnalyticalException from analytical.utils import AnalyticalException

View file

@ -8,7 +8,7 @@ from django.template import Context
from django.test.utils import override_settings from django.test.utils import override_settings
from analytical.templatetags.yandex_metrica import YandexMetricaNode from analytical.templatetags.yandex_metrica import YandexMetricaNode
from analytical.tests.utils import TagTestCase from utils import TagTestCase
from analytical.utils import AnalyticalException from analytical.utils import AnalyticalException

View file

@ -16,7 +16,7 @@ from analytical.utils import (
get_required_setting, get_required_setting,
is_internal_ip, is_internal_ip,
) )
from analytical.tests.utils import TestCase from utils import TestCase
class SettingDeletedTestCase(TestCase): class SettingDeletedTestCase(TestCase):
@ -35,6 +35,10 @@ class MyUser(AbstractBaseUser):
identity = models.CharField(max_length=50) identity = models.CharField(max_length=50)
USERNAME_FIELD = 'identity' USERNAME_FIELD = 'identity'
class Meta:
abstract = True
app_label = 'testapp'
class GetIdentityTestCase(TestCase): class GetIdentityTestCase(TestCase):
def test_custom_username_field(self): def test_custom_username_field(self):