Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fixed #14049 -- Made our TestCase subclasses not load database fixtur…

…es (nor set up custom URLconfs) for test methods that are going to be skipped. Thanks zimnyx for the report.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 703498b commit 4ab5a43785418a8bb46bcc480a1cf73bde631e2f @ramiro ramiro committed
5 django/test/
@@ -282,6 +282,11 @@ def __call__(self, result=None):
set up. This means that user-defined Test Cases aren't required to
include a call to super().setUp().
+ testMethod = getattr(self, self._testMethodName)
+ if (getattr(self.__class__, "__unittest_skip__", False) or
+ getattr(testMethod, "__unittest_skip__", False)):
+ return
self.client = self.client_class()
16 tests/regressiontests/test_utils/
@@ -3,6 +3,7 @@
import sys
from django.test import TestCase, skipUnlessDBFeature, skipIfDBFeature
+from django.utils.unittest import skip
from models import Person
@@ -115,6 +116,21 @@ class MyWarning(Warning):
# Remove the filter we just added.
+class SkippingExtraTests(TestCase):
+ fixtures = ['should_not_be_loaded.json']
+ # HACK: This depends on internals of our TestCase subclasses
+ def __call__(self, result=None):
+ # Detect fixture loading by counting SQL queries, should be zero
+ with self.assertNumQueries(0):
+ super(SkippingExtraTests, self).__call__(result)
+ @skip("Fixture loading should not be performed for skipped tests.")
+ def test_fixtures_are_skipped(self):
+ pass
__test__ = {"API_TEST": r"""
# Some checks of the doctest output normalizer.
# Standard doctests do fairly

0 comments on commit 4ab5a43

Please sign in to comment.
Something went wrong with that request. Please try again.