diff test/test_mailgw.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 a46d5d0fd5f8
line wrap: on
line diff
--- a/test/test_mailgw.py	Fri Aug 21 13:08:02 2015 +1000
+++ b/test/test_mailgw.py	Mon Sep 07 23:24:33 2015 +1000
@@ -17,14 +17,13 @@
 
 import pytest
 
+# FIX: workaround for a bug in pytest.mark.skipif():
+#   https://github.com/pytest-dev/pytest/issues/568
 try:
     import pyme, pyme.core
-    SKIP_PGP = False
+    skip_pgp = lambda func, *args, **kwargs: func
 except ImportError:
-    SKIP_PGP = True
-
-skip_pgp = pytest.mark.skipif(
-    SKIP_PGP, reason="Skipping PGP tests: 'pyme' not installed")
+    skip_pgp = pytest.skip("Skipping PGP tests: 'pyme' not installed")
 
 
 from cStringIO import StringIO

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