__init__.py 897 B

12345678910111213141516171819202122232425
  1. import unittest
  2. from forms_tests.widget_tests.base import WidgetTest
  3. from django.db import connection
  4. from django.db.backends.signals import connection_created
  5. from django.test import TestCase, modify_settings
  6. @unittest.skipUnless(connection.vendor == 'postgresql', "PostgreSQL specific tests")
  7. class PostgreSQLTestCase(TestCase):
  8. @classmethod
  9. def tearDownClass(cls):
  10. # No need to keep that signal overhead for non PostgreSQL-related tests.
  11. from django.contrib.postgres.signals import register_type_handlers
  12. connection_created.disconnect(register_type_handlers)
  13. super().tearDownClass()
  14. @unittest.skipUnless(connection.vendor == 'postgresql', "PostgreSQL specific tests")
  15. # To locate the widget's template.
  16. @modify_settings(INSTALLED_APPS={'append': 'django.contrib.postgres'})
  17. class PostgreSQLWidgetTestCase(WidgetTest, PostgreSQLTestCase):
  18. pass