Loading tests/forms_tests/tests/tests.py +4 −2 Original line number Diff line number Diff line Loading @@ -209,6 +209,7 @@ class RelatedModelFormTests(TestCase): class Meta: model = A fields = '__all__' self.assertRaises(ValueError, ModelFormMetaclass, str('Form'), (ModelForm,), {'Meta': Meta}) Loading @@ -227,6 +228,7 @@ class RelatedModelFormTests(TestCase): class Meta: model = A fields = '__all__' self.assertTrue(issubclass(ModelFormMetaclass(str('Form'), (ModelForm,), {'Meta': Meta}), ModelForm)) Loading tests/model_forms/tests.py +4 −1 Original line number Diff line number Diff line Loading @@ -53,11 +53,14 @@ class PriceForm(forms.ModelForm): class BookForm(forms.ModelForm): class Meta: model = Book fields = '__all__' class DerivedBookForm(forms.ModelForm): class Meta: model = DerivedBook fields = '__all__' class ExplicitPKForm(forms.ModelForm): Loading tests/model_forms_regress/tests.py +3 −1 Original line number Diff line number Diff line Loading @@ -97,12 +97,14 @@ class PartiallyLocalizedTripleForm(forms.ModelForm): class Meta: model = Triple localized_fields = ('left', 'right',) fields = '__all__' class FullyLocalizedTripleForm(forms.ModelForm): class Meta: model = Triple localized_fields = "__all__" localized_fields = '__all__' fields = '__all__' class LocalizedModelFormTest(TestCase): def test_model_form_applies_localize_to_some_fields(self): Loading tests/runtests.py +4 −1 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ import shutil import subprocess import sys import tempfile import warnings from django import contrib from django.utils._os import upath Loading Loading @@ -107,6 +108,8 @@ def setup(verbosity, test_labels): logger.addHandler(handler) # Load all the ALWAYS_INSTALLED_APPS. with warnings.catch_warnings(): warnings.filterwarnings('ignore', 'django.contrib.comments is deprecated and will be removed before Django 1.8.', PendingDeprecationWarning) get_apps() # Load all the test model apps. Loading tests/test_runner/tests.py +8 −6 Original line number Diff line number Diff line Loading @@ -10,8 +10,8 @@ from django.core.exceptions import ImproperlyConfigured from django.core.management import call_command from django import db from django.test import runner, TransactionTestCase, skipUnlessDBFeature from django.test.simple import DjangoTestSuiteRunner, get_tests from django.test.testcases import connections_support_transactions from django.test.utils import IgnorePendingDeprecationWarningsMixin from django.utils import unittest from django.utils.importlib import import_module Loading Loading @@ -225,15 +225,17 @@ class Ticket17477RegressionTests(AdminScriptTestCase): self.assertNoOutput(err) class ModulesTestsPackages(unittest.TestCase): class ModulesTestsPackages(IgnorePendingDeprecationWarningsMixin, unittest.TestCase): def test_get_tests(self): "Check that the get_tests helper function can find tests in a directory" from django.test.simple import get_tests module = import_module(TEST_APP_OK) tests = get_tests(module) self.assertIsInstance(tests, type(module)) def test_import_error(self): "Test for #12658 - Tests with ImportError's shouldn't fail silently" from django.test.simple import get_tests module = import_module(TEST_APP_ERROR) self.assertRaises(ImportError, get_tests, module) Loading @@ -258,7 +260,7 @@ class Sqlite3InMemoryTestDbs(unittest.TestCase): }, }) other = db.connections['other'] DjangoTestSuiteRunner(verbosity=0).setup_databases() runner.DiscoverRunner(verbosity=0).setup_databases() msg = "DATABASES setting '%s' option set to sqlite3's ':memory:' value shouldn't interfere with transaction support detection." % option # Transaction support should be properly initialised for the 'other' DB self.assertTrue(other.features.supports_transactions, msg) Loading @@ -273,12 +275,12 @@ class DummyBackendTest(unittest.TestCase): """ Test that setup_databases() doesn't fail with dummy database backend. """ runner = DjangoTestSuiteRunner(verbosity=0) runner_instance = runner.DiscoverRunner(verbosity=0) old_db_connections = db.connections try: db.connections = db.ConnectionHandler({}) old_config = runner.setup_databases() runner.teardown_databases(old_config) old_config = runner_instance.setup_databases() runner_instance.teardown_databases(old_config) except Exception as e: self.fail("setup_databases/teardown_databases unexpectedly raised " "an error: %s" % e) Loading Loading
tests/forms_tests/tests/tests.py +4 −2 Original line number Diff line number Diff line Loading @@ -209,6 +209,7 @@ class RelatedModelFormTests(TestCase): class Meta: model = A fields = '__all__' self.assertRaises(ValueError, ModelFormMetaclass, str('Form'), (ModelForm,), {'Meta': Meta}) Loading @@ -227,6 +228,7 @@ class RelatedModelFormTests(TestCase): class Meta: model = A fields = '__all__' self.assertTrue(issubclass(ModelFormMetaclass(str('Form'), (ModelForm,), {'Meta': Meta}), ModelForm)) Loading
tests/model_forms/tests.py +4 −1 Original line number Diff line number Diff line Loading @@ -53,11 +53,14 @@ class PriceForm(forms.ModelForm): class BookForm(forms.ModelForm): class Meta: model = Book fields = '__all__' class DerivedBookForm(forms.ModelForm): class Meta: model = DerivedBook fields = '__all__' class ExplicitPKForm(forms.ModelForm): Loading
tests/model_forms_regress/tests.py +3 −1 Original line number Diff line number Diff line Loading @@ -97,12 +97,14 @@ class PartiallyLocalizedTripleForm(forms.ModelForm): class Meta: model = Triple localized_fields = ('left', 'right',) fields = '__all__' class FullyLocalizedTripleForm(forms.ModelForm): class Meta: model = Triple localized_fields = "__all__" localized_fields = '__all__' fields = '__all__' class LocalizedModelFormTest(TestCase): def test_model_form_applies_localize_to_some_fields(self): Loading
tests/runtests.py +4 −1 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ import shutil import subprocess import sys import tempfile import warnings from django import contrib from django.utils._os import upath Loading Loading @@ -107,6 +108,8 @@ def setup(verbosity, test_labels): logger.addHandler(handler) # Load all the ALWAYS_INSTALLED_APPS. with warnings.catch_warnings(): warnings.filterwarnings('ignore', 'django.contrib.comments is deprecated and will be removed before Django 1.8.', PendingDeprecationWarning) get_apps() # Load all the test model apps. Loading
tests/test_runner/tests.py +8 −6 Original line number Diff line number Diff line Loading @@ -10,8 +10,8 @@ from django.core.exceptions import ImproperlyConfigured from django.core.management import call_command from django import db from django.test import runner, TransactionTestCase, skipUnlessDBFeature from django.test.simple import DjangoTestSuiteRunner, get_tests from django.test.testcases import connections_support_transactions from django.test.utils import IgnorePendingDeprecationWarningsMixin from django.utils import unittest from django.utils.importlib import import_module Loading Loading @@ -225,15 +225,17 @@ class Ticket17477RegressionTests(AdminScriptTestCase): self.assertNoOutput(err) class ModulesTestsPackages(unittest.TestCase): class ModulesTestsPackages(IgnorePendingDeprecationWarningsMixin, unittest.TestCase): def test_get_tests(self): "Check that the get_tests helper function can find tests in a directory" from django.test.simple import get_tests module = import_module(TEST_APP_OK) tests = get_tests(module) self.assertIsInstance(tests, type(module)) def test_import_error(self): "Test for #12658 - Tests with ImportError's shouldn't fail silently" from django.test.simple import get_tests module = import_module(TEST_APP_ERROR) self.assertRaises(ImportError, get_tests, module) Loading @@ -258,7 +260,7 @@ class Sqlite3InMemoryTestDbs(unittest.TestCase): }, }) other = db.connections['other'] DjangoTestSuiteRunner(verbosity=0).setup_databases() runner.DiscoverRunner(verbosity=0).setup_databases() msg = "DATABASES setting '%s' option set to sqlite3's ':memory:' value shouldn't interfere with transaction support detection." % option # Transaction support should be properly initialised for the 'other' DB self.assertTrue(other.features.supports_transactions, msg) Loading @@ -273,12 +275,12 @@ class DummyBackendTest(unittest.TestCase): """ Test that setup_databases() doesn't fail with dummy database backend. """ runner = DjangoTestSuiteRunner(verbosity=0) runner_instance = runner.DiscoverRunner(verbosity=0) old_db_connections = db.connections try: db.connections = db.ConnectionHandler({}) old_config = runner.setup_databases() runner.teardown_databases(old_config) old_config = runner_instance.setup_databases() runner_instance.teardown_databases(old_config) except Exception as e: self.fail("setup_databases/teardown_databases unexpectedly raised " "an error: %s" % e) Loading