File: test_django_config_detection.py

package info (click to toggle)
django-haystack 3.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,504 kB
  • sloc: python: 23,475; xml: 1,708; sh: 74; makefile: 71
file content (25 lines) | stat: -rw-r--r-- 805 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
""""""

import unittest

import django
from django.test import TestCase

import haystack


class AppConfigCompatibilityTestCase(TestCase):
    @unittest.skipIf(
        django.VERSION >= (3, 2), "default_app_config is deprecated since django 3.2."
    )
    def testDefaultAppConfigIsDefined_whenDjangoVersionIsLessThan3_2(self):
        has_default_appconfig_attr = hasattr(haystack, "default_app_config")
        self.assertTrue(has_default_appconfig_attr)

    @unittest.skipIf(
        django.VERSION < (3, 2),
        "default_app_config should be used in versions prior to django 3.2.",
    )
    def testDefaultAppConfigIsDefined_whenDjangoVersionIsMoreThan3_2(self):
        has_default_appconfig_attr = hasattr(haystack, "default_app_config")
        self.assertFalse(has_default_appconfig_attr)