Mercurial > p > roundup > code
comparison test/test_postgresql.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 | 57452bc6d989 |
comparison
equal
deleted
inserted
replaced
| 5108:67fad01d2009 | 5109:43a1f7fe39f5 |
|---|---|
| 24 from db_test_base import ConcurrentDBTest, HTMLItemTest, FilterCacheTest | 24 from db_test_base import ConcurrentDBTest, HTMLItemTest, FilterCacheTest |
| 25 from db_test_base import ClassicInitBase, setupTracker | 25 from db_test_base import ClassicInitBase, setupTracker |
| 26 | 26 |
| 27 from roundup.backends import get_backend, have_backend | 27 from roundup.backends import get_backend, have_backend |
| 28 | 28 |
| 29 # FIX: workaround for a bug in pytest.mark.skipif(): | |
| 30 # https://github.com/pytest-dev/pytest/issues/568 | |
| 31 if not have_backend('postgresql'): | 29 if not have_backend('postgresql'): |
| 32 skip_postgresql = pytest.mark.skip( | 30 # FIX: workaround for a bug in pytest.mark.skip(): |
| 33 reason='Skipping PostgreSQL tests: backend not available') | 31 # https://github.com/pytest-dev/pytest/issues/568 |
| 32 from .pytest_patcher import mark_class | |
| 33 skip_postgresql = mark_class(pytest.mark.skip( | |
| 34 reason='Skipping PostgreSQL tests: backend not available')) | |
| 34 else: | 35 else: |
| 35 skip_postgresql = lambda func, *args, **kwargs: func | 36 skip_postgresql = lambda func, *args, **kwargs: func |
| 36 | 37 |
| 37 | 38 |
| 38 class postgresqlOpener: | 39 class postgresqlOpener: |
