Mercurial > p > roundup > code
comparison test/test_mailgw.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 | 14abd0a67207 |
comparison
equal
deleted
inserted
replaced
| 5108:67fad01d2009 | 5109:43a1f7fe39f5 |
|---|---|
| 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 | |
| 22 try: | 20 try: |
| 23 import pyme, pyme.core | 21 import pyme, pyme.core |
| 24 skip_pgp = lambda func, *args, **kwargs: func | 22 skip_pgp = lambda func, *args, **kwargs: func |
| 25 except ImportError: | 23 except ImportError: |
| 26 skip_pgp = pytest.mark.skip( | 24 # FIX: workaround for a bug in pytest.mark.skip(): |
| 27 reason="Skipping PGP tests: 'pyme' not installed") | 25 # https://github.com/pytest-dev/pytest/issues/568 |
| 26 from .pytest_patcher import mark_class | |
| 27 skip_pgp = mark_class(pytest.mark.skip( | |
| 28 reason="Skipping PGP tests: 'pyme' not installed")) | |
| 28 | 29 |
| 29 | 30 |
| 30 from cStringIO import StringIO | 31 from cStringIO import StringIO |
| 31 | 32 |
| 32 if not os.environ.has_key('SENDMAILDEBUG'): | 33 if not os.environ.has_key('SENDMAILDEBUG'): |
