def test_validate_models_django17(self): self.patch('celery.fixups.django.symbol_by_name') self.patch('celery.fixups.django.import_module') self.mock_modules('django.core.management.base') from django.core.management import base f = self.Fixup(self.app) f._validate_models_django17() base.BaseCommand.assert_called_with() base.BaseCommand().check.assert_called_with()
def _validate_models_django17(self): from django.core.management import base print(base) cmd = base.BaseCommand() try: cmd.stdout = base.OutputWrapper(sys.stdout) cmd.stderr = base.OutputWrapper(sys.stderr) except ImportError: # before django 1.5 cmd.stdout, cmd.stderr = sys.stdout, sys.stderr cmd.check()