Mercurial > p > roundup > code
diff test/test_indexer.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 | d26921b851c3 |
line wrap: on
line diff
--- a/test/test_indexer.py Mon Jun 27 22:10:45 2016 -0400 +++ b/test/test_indexer.py Tue Jun 28 15:39:38 2016 +1000 @@ -30,21 +30,25 @@ from .test_mysql import mysqlOpener, skip_mysql from test_sqlite import sqliteOpener -# FIX: workaround for a bug in pytest.mark.skipif(): -# https://github.com/pytest-dev/pytest/issues/568 try: import xapian skip_xapian = lambda func, *args, **kwargs: func except ImportError: - skip_xapian = pytest.mark.skip( - "Skipping Xapian indexer tests: 'xapian' not installed") + # FIX: workaround for a bug in pytest.mark.skip(): + # https://github.com/pytest-dev/pytest/issues/568 + from .pytest_patcher import mark_class + skip_xapian = mark_class(pytest.mark.skip( + "Skipping Xapian indexer tests: 'xapian' not installed")) try: import whoosh skip_whoosh = lambda func, *args, **kwargs: func except ImportError: - skip_whoosh = pytest.mark.skip( - "Skipping Whoosh indexer tests: 'whoosh' not installed") + # FIX: workaround for a bug in pytest.mark.skip(): + # https://github.com/pytest-dev/pytest/issues/568 + from .pytest_patcher import mark_class + skip_whoosh = mark_class(pytest.mark.skip( + "Skipping Whoosh indexer tests: 'whoosh' not installed")) class db:
