Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #20437 - marked a test-runner test as expected-fail under certa…

…in conditions.
  • Loading branch information...
commit a7dc13ec231faf917c3125eb4c158138d4edde10 1 parent 022de7e
Carl Meyer carljm authored
Showing with 17 additions and 0 deletions.
  1. +17 −0 tests/test_runner/test_discover_runner.py
17 tests/test_runner/test_discover_runner.py
View
@@ -1,8 +1,22 @@
from contextlib import contextmanager
import os
+import sys
from django.test import TestCase
from django.test.runner import DiscoverRunner
+from django.utils.unittest import expectedFailure
+
+try:
+ import unittest2
+except ImportError:
+ unittest2 = None
+
+
+def expectedFailureIf(condition):
+ """Marks a test as an expected failure if ``condition`` is met."""
+ if condition:
+ return expectedFailure
+ return lambda func: func
class DiscoverRunnerTest(TestCase):
@@ -35,6 +49,9 @@ def test_dotted_test_class_django_testcase(self):
self.assertEqual(count, 1)
+ # this test fails if unittest2 is installed from PyPI on Python 2.6
+ # refs https://code.djangoproject.com/ticket/20437
+ @expectedFailureIf(sys.version_info < (2, 7) and unittest2)
def test_dotted_test_method_vanilla_unittest(self):
count = DiscoverRunner().build_suite(
["test_discovery_sample.tests_sample.TestVanillaUnittest.test_sample"],
Please sign in to comment.
Something went wrong with that request. Please try again.