Merge pull request #4308 from asottile/compare_versions_with_loose_version

Don't string-compare version numbers
This commit is contained in:
Anthony Sottile 2018-11-05 12:42:26 -08:00 committed by GitHub
commit 176d27440c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -0,0 +1 @@
Parse ``minversion`` as an actual version and not as dot-separated strings.

View File

@ -11,6 +11,7 @@ import shlex
import sys
import types
import warnings
from distutils.version import LooseVersion
import py
import six
@ -816,9 +817,7 @@ class Config(object):
minver = self.inicfg.get("minversion", None)
if minver:
ver = minver.split(".")
myver = pytest.__version__.split(".")
if myver < ver:
if LooseVersion(minver) > LooseVersion(pytest.__version__):
raise pytest.UsageError(
"%s:%d: requires pytest-%s, actual pytest-%s'"
% (