Mercurial > p > roundup > code
diff 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 |
line wrap: on
line diff
--- a/test/test_dates.py Fri Aug 21 13:08:02 2015 +1000 +++ b/test/test_dates.py Mon Sep 07 23:24:33 2015 +1000 @@ -25,13 +25,13 @@ from roundup.date import Date, Interval, Range, fixTimeOverflow, \ get_timezone +# FIX: workaround for a bug in pytest.mark.skipif(): +# https://github.com/pytest-dev/pytest/issues/568 try: import pytz - SKIP_PYTZ = False + skip_pytz = lambda func, *args, **kwargs: func except ImportError: - SKIP_PYTZ = True - -skip_pytz = pytest.mark.skipif(SKIP_PYTZ, reason="'pytz' not installed") + skip_pytz = pytest.skip("'pytz' not installed") class DateTestCase(unittest.TestCase):
