Mercurial > p > roundup > code
comparison test/test_dates.py @ 5109:43a1f7fe39f5
Improved work-around for pytest markers bug
The previous fix was only a partial solution. Any test class sharing a
parent with, and appearing after, a skipped test class was being skipped
(not just other test classes using the skip/skipif marker). Now only
tests that should be skipped will be skipped, the rest should run as
normal.
| author | John Kristensen <john@jerrykan.com> |
|---|---|
| date | Tue, 28 Jun 2016 15:39:38 +1000 |
| parents | 37d1e24fb941 |
| children | 64c4e43fbb84 |
comparison
equal
deleted
inserted
replaced
| 5108:67fad01d2009 | 5109:43a1f7fe39f5 |
|---|---|
| 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 | |
| 30 try: | 28 try: |
| 31 import pytz | 29 import pytz |
| 32 skip_pytz = lambda func, *args, **kwargs: func | 30 skip_pytz = lambda func, *args, **kwargs: func |
| 33 except ImportError: | 31 except ImportError: |
| 34 skip_pytz = pytest.mark.skip(reason="'pytz' not installed") | 32 # FIX: workaround for a bug in pytest.mark.skip(): |
| 33 # https://github.com/pytest-dev/pytest/issues/568 | |
| 34 from .pytest_patcher import mark_class | |
| 35 skip_pytz = mark_class(pytest.mark.skip(reason="'pytz' not installed")) | |
| 35 | 36 |
| 36 | 37 |
| 37 class DateTestCase(unittest.TestCase): | 38 class DateTestCase(unittest.TestCase): |
| 38 def setUp(self): | 39 def setUp(self): |
| 39 self.old_gettext_ = i18n.gettext | 40 self.old_gettext_ = i18n.gettext |
