fix a few issues with pytest-2.7 branch and bump version number

- importorskip: skip a test if we have a minversion but cannot parse
  version numbers due to pkg_resources not present
- make runner tests work with latest xdist
This commit is contained in:
holger krekel 2015-09-15 12:17:52 +02:00
parent f6506fa6ca
commit 16720b96b4
3 changed files with 13 additions and 7 deletions

View File

@ -1,2 +1,2 @@
#
__version__ = '2.7.2'
__version__ = '2.7.3'

View File

@ -1,10 +1,9 @@
""" basic collect and runtest protocol implementations """
import bdb
import sys
import re
from time import time
from pkg_resources import parse_version
import py
import pytest
from py._code.code import TerminalRepr
@ -496,7 +495,14 @@ def importorskip(modname, minversion=None):
if minversion is None:
return mod
verattr = getattr(mod, '__version__', None)
if verattr is None or parse_version(verattr) < parse_version(minversion):
skip("module %r has __version__ %r, required is: %r" %(
modname, verattr, minversion))
if minversion is not None:
try:
from pkg_resources import parse_version as pv
except ImportError:
skip("we have a required version for %r but can not import "
"no pkg_resources to parse version strings." %(modname,))
if verattr is None or pv(verattr) < pv(minversion):
skip("module %r has __version__ %r, required is: %r" %(
modname, verattr, minversion))
return mod

View File

@ -293,7 +293,7 @@ class TestExecutionForked(BaseFunctionalTests):
def getrunner(self):
# XXX re-arrange this test to live in pytest-xdist
xplugin = pytest.importorskip("xdist.plugin")
xplugin = pytest.importorskip("xdist.boxed")
return xplugin.forked_run_report
def test_suicide(self, testdir):