Mercurial > p > roundup > code
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 5037:364c54991861 | 5038:c977f3530944 |
|---|---|
| 15 import gpgmelib | 15 import gpgmelib |
| 16 import unittest, tempfile, os, shutil, errno, imp, sys, difflib, time | 16 import unittest, tempfile, os, shutil, errno, imp, sys, difflib, time |
| 17 | 17 |
| 18 import pytest | 18 import pytest |
| 19 | 19 |
| 20 # FIX: workaround for a bug in pytest.mark.skipif(): | |
| 21 # https://github.com/pytest-dev/pytest/issues/568 | |
| 20 try: | 22 try: |
| 21 import pyme, pyme.core | 23 import pyme, pyme.core |
| 22 SKIP_PGP = False | 24 skip_pgp = lambda func, *args, **kwargs: func |
| 23 except ImportError: | 25 except ImportError: |
| 24 SKIP_PGP = True | 26 skip_pgp = pytest.skip("Skipping PGP tests: 'pyme' not installed") |
| 25 | |
| 26 skip_pgp = pytest.mark.skipif( | |
| 27 SKIP_PGP, reason="Skipping PGP tests: 'pyme' not installed") | |
| 28 | 27 |
| 29 | 28 |
| 30 from cStringIO import StringIO | 29 from cStringIO import StringIO |
| 31 | 30 |
| 32 if not os.environ.has_key('SENDMAILDEBUG'): | 31 if not os.environ.has_key('SENDMAILDEBUG'): |
