Skip to content

Commit

Permalink
fix missing subTest
Browse files Browse the repository at this point in the history
  • Loading branch information
rtaycher committed Aug 31, 2020
1 parent fc84fa8 commit f006cad
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/test_past/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import os.path
import sys
import traceback
from contextlib import contextmanager

from future.tests.base import unittest
from past.builtins import cmp
Expand All @@ -17,10 +18,16 @@
import test_values


@contextmanager
def empty_context_manager(*args, **kwargs):
return dict(args=args, kwargs=kwargs)


class TestCmp(unittest.TestCase):
def test_cmp(self):
for x, y, cmp_python2_value in test_values.cmp_python2_value:
with self.subTest(x=x, y=y):
# to get this to run on python <3.4 which lacks subTest
with getattr(self, 'subTest', empty_context_manager)(x=x, y=y):
try:
past_cmp_value = cmp(x, y)
except Exception:
Expand Down

0 comments on commit f006cad

Please sign in to comment.