comparison test/test_dates.py @ 5038:c977f3530944

Work-around for pytest.mark.skipif() bug There is a pytest bug that can cause all test classes marked with the skipif() decorator that inherit a common class to be skipped if one of the skipif() conditions is True. See: https://github.com/pytest-dev/pytest/issues/568
author John Kristensen <john@jerrykan.com>
date Mon, 07 Sep 2015 23:24:33 +1000
parents 364c54991861
children 37d1e24fb941
comparison
equal deleted inserted replaced
5037:364c54991861 5038:c977f3530944
23 import pytest 23 import pytest
24 from roundup import date, i18n 24 from roundup import date, i18n
25 from roundup.date import Date, Interval, Range, fixTimeOverflow, \ 25 from roundup.date import Date, Interval, Range, fixTimeOverflow, \
26 get_timezone 26 get_timezone
27 27
28 # FIX: workaround for a bug in pytest.mark.skipif():
29 # https://github.com/pytest-dev/pytest/issues/568
28 try: 30 try:
29 import pytz 31 import pytz
30 SKIP_PYTZ = False 32 skip_pytz = lambda func, *args, **kwargs: func
31 except ImportError: 33 except ImportError:
32 SKIP_PYTZ = True 34 skip_pytz = pytest.skip("'pytz' not installed")
33
34 skip_pytz = pytest.mark.skipif(SKIP_PYTZ, reason="'pytz' not installed")
35 35
36 36
37 class DateTestCase(unittest.TestCase): 37 class DateTestCase(unittest.TestCase):
38 def setUp(self): 38 def setUp(self):
39 self.old_gettext_ = i18n.gettext 39 self.old_gettext_ = i18n.gettext

Roundup Issue Tracker: http://roundup-tracker.org/