Skip to content

Commit

Permalink
Merge pull request #4308 from asottile/compare_versions_with_loose_ve…
Browse files Browse the repository at this point in the history
…rsion

Don't string-compare version numbers
  • Loading branch information
asottile committed Nov 5, 2018
2 parents 832b59b + 85a3333 commit 176d274
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog/4306.bugfix.rst
@@ -0,0 +1 @@
Parse ``minversion`` as an actual version and not as dot-separated strings.
5 changes: 2 additions & 3 deletions src/_pytest/config/__init__.py
Expand Up @@ -11,6 +11,7 @@
import sys
import types
import warnings
from distutils.version import LooseVersion

import py
import six
Expand Down Expand Up @@ -816,9 +817,7 @@ def _checkversion(self):

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'"
% (
Expand Down

0 comments on commit 176d274

Please sign in to comment.