diff test/test_postgresql.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_postgresql.py	Fri Aug 21 13:08:02 2015 +1000
+++ b/test/test_postgresql.py	Mon Sep 07 23:24:33 2015 +1000
@@ -26,13 +26,13 @@
 
 from roundup.backends import get_backend, have_backend
 
+# FIX: workaround for a bug in pytest.mark.skipif():
+#   https://github.com/pytest-dev/pytest/issues/568
 if not have_backend('postgresql'):
-    SKIP_POSTGRESQL = True
+    skip_postgresql = pytest.skip(
+        'Skipping PostgreSQL tests: backend not available')
 else:
-    SKIP_POSTGRESQL = False
-
-skip_postgresql = pytest.mark.skipif(
-    SKIP_POSTGRESQL, reason='Skipping PostgreSQL tests: not enabled')
+    skip_postgresql = lambda func, *args, **kwargs: func
 
 
 class postgresqlOpener:

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