Use pkg_resources to parse the actual pytest version

This commit is contained in:
Bruno Oliveira
2017-08-09 10:09:29 -03:00
parent 0987356f64
commit fb6a6872a0

View File

@@ -340,8 +340,10 @@ class TestTerminalReporting:
]) ])
@pytest.mark.parametrize('n', ['-n0', '-n1']) @pytest.mark.parametrize('n', ['-n0', '-n1'])
@pytest.mark.skipif(pytest.__version__ < "3.1", reason='pytest warnings requires >= 3.1')
def test_logwarning(self, testdir, n): def test_logwarning(self, testdir, n):
from pkg_resources import parse_version
if parse_version(pytest.__version__) < parse_version('3.1'):
pytest.skip('pytest warnings requires >= 3.1')
testdir.makepyfile(""" testdir.makepyfile("""
import warnings import warnings
def test_func(): def test_func():