diff --git a/categories/__init__.py b/categories/__init__.py index eae85e8..cc97aec 100644 --- a/categories/__init__.py +++ b/categories/__init__.py @@ -21,16 +21,3 @@ __version__ = get_version() default_app_config = 'categories.apps.CategoriesConfig' - - -def register(): - from categories import settings - from categories.registration import (_process_registry, registry) - _process_registry(settings.FK_REGISTRY, registry.register_fk) - _process_registry(settings.M2M_REGISTRY, registry.register_m2m) - - -try: - register() -except Exception as e: - print(e) diff --git a/categories/tests/test_mgmt_commands.py b/categories/tests/test_mgmt_commands.py index 78c1b28..7466910 100644 --- a/categories/tests/test_mgmt_commands.py +++ b/categories/tests/test_mgmt_commands.py @@ -1,20 +1,28 @@ # -*- coding: utf-8 -*- -from unittest import skip - from django.core import management from django.core.management.base import CommandError +from django.db import connection from django.test import TestCase class TestMgmtCommands(TestCase): + @classmethod + def setUpClass(cls): + connection.disable_constraint_checking() + super(TestMgmtCommands, cls).setUpClass() + + @classmethod + def tearDownClass(cls): + super(TestMgmtCommands, cls).tearDownClass() + connection.enable_constraint_checking() + def test_add_category_fields(self): management.call_command('add_category_fields', verbosity=0) def test_add_category_fields_app(self): management.call_command('add_category_fields', 'flatpages', verbosity=0) - @skip("Breaks with Django > 2. Skipping until it can be fixed.") def test_drop_category_field(self): management.call_command('drop_category_field', 'flatpages', 'flatpage', 'category', verbosity=0)