Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

…in conditions.
  • Loading branch information...
commit a7dc13ec231faf917c3125eb4c158138d4edde10 1 parent 022de7e
Carl Meyer authored May 20, 2013

Showing 1 changed file with 17 additions and 0 deletions. Show diff stats Hide diff stats

  1. 17  tests/test_runner/test_discover_runner.py
17  tests/test_runner/test_discover_runner.py
... ...
@@ -1,8 +1,22 @@
1 1
 from contextlib import contextmanager
2 2
 import os
  3
+import sys
3 4
 
4 5
 from django.test import TestCase
5 6
 from django.test.runner import DiscoverRunner
  7
+from django.utils.unittest import expectedFailure
  8
+
  9
+try:
  10
+    import unittest2
  11
+except ImportError:
  12
+    unittest2 = None
  13
+
  14
+
  15
+def expectedFailureIf(condition):
  16
+    """Marks a test as an expected failure if ``condition`` is met."""
  17
+    if condition:
  18
+        return expectedFailure
  19
+    return lambda func: func
6 20
 
7 21
 
8 22
 class DiscoverRunnerTest(TestCase):
@@ -35,6 +49,9 @@ def test_dotted_test_class_django_testcase(self):
35 49
 
36 50
         self.assertEqual(count, 1)
37 51
 
  52
+    # this test fails if unittest2 is installed from PyPI on Python 2.6
  53
+    # refs https://code.djangoproject.com/ticket/20437
  54
+    @expectedFailureIf(sys.version_info < (2, 7) and unittest2)
38 55
     def test_dotted_test_method_vanilla_unittest(self):
39 56
         count = DiscoverRunner().build_suite(
40 57
             ["test_discovery_sample.tests_sample.TestVanillaUnittest.test_sample"],

0 notes on commit a7dc13e

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