Skip to content

Commit

Permalink
Don't string-compare version numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
asottile committed Nov 5, 2018
1 parent 4aa3c4f commit 85a3333
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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 85a3333

Please sign in to comment.