Skip to content

Commit f006cad

Browse files
committed
fix missing subTest
1 parent fc84fa8 commit f006cad

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Diff for: tests/test_past/test_misc.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import os.path
99
import sys
1010
import traceback
11+
from contextlib import contextmanager
1112

1213
from future.tests.base import unittest
1314
from past.builtins import cmp
@@ -17,10 +18,16 @@
1718
import test_values
1819

1920

21+
@contextmanager
22+
def empty_context_manager(*args, **kwargs):
23+
return dict(args=args, kwargs=kwargs)
24+
25+
2026
class TestCmp(unittest.TestCase):
2127
def test_cmp(self):
2228
for x, y, cmp_python2_value in test_values.cmp_python2_value:
23-
with self.subTest(x=x, y=y):
29+
# to get this to run on python <3.4 which lacks subTest
30+
with getattr(self, 'subTest', empty_context_manager)(x=x, y=y):
2431
try:
2532
past_cmp_value = cmp(x, y)
2633
except Exception:

0 commit comments

Comments
 (0)