comparison 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
comparison
equal deleted inserted replaced
5108:67fad01d2009 5109:43a1f7fe39f5
28 from db_test_base import setupSchema, config 28 from db_test_base import setupSchema, config
29 from .test_postgresql import postgresqlOpener, skip_postgresql 29 from .test_postgresql import postgresqlOpener, skip_postgresql
30 from .test_mysql import mysqlOpener, skip_mysql 30 from .test_mysql import mysqlOpener, skip_mysql
31 from test_sqlite import sqliteOpener 31 from test_sqlite import sqliteOpener
32 32
33 # FIX: workaround for a bug in pytest.mark.skipif():
34 # https://github.com/pytest-dev/pytest/issues/568
35 try: 33 try:
36 import xapian 34 import xapian
37 skip_xapian = lambda func, *args, **kwargs: func 35 skip_xapian = lambda func, *args, **kwargs: func
38 except ImportError: 36 except ImportError:
39 skip_xapian = pytest.mark.skip( 37 # FIX: workaround for a bug in pytest.mark.skip():
40 "Skipping Xapian indexer tests: 'xapian' not installed") 38 # https://github.com/pytest-dev/pytest/issues/568
39 from .pytest_patcher import mark_class
40 skip_xapian = mark_class(pytest.mark.skip(
41 "Skipping Xapian indexer tests: 'xapian' not installed"))
41 42
42 try: 43 try:
43 import whoosh 44 import whoosh
44 skip_whoosh = lambda func, *args, **kwargs: func 45 skip_whoosh = lambda func, *args, **kwargs: func
45 except ImportError: 46 except ImportError:
46 skip_whoosh = pytest.mark.skip( 47 # FIX: workaround for a bug in pytest.mark.skip():
47 "Skipping Whoosh indexer tests: 'whoosh' not installed") 48 # https://github.com/pytest-dev/pytest/issues/568
49 from .pytest_patcher import mark_class
50 skip_whoosh = mark_class(pytest.mark.skip(
51 "Skipping Whoosh indexer tests: 'whoosh' not installed"))
48 52
49 53
50 class db: 54 class db:
51 class config(dict): 55 class config(dict):
52 DATABASE = 'test-index' 56 DATABASE = 'test-index'

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