Skip to content

Commit 85a3333

Browse files
committed
Don't string-compare version numbers
1 parent 4aa3c4f commit 85a3333

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

changelog/4306.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Parse ``minversion`` as an actual version and not as dot-separated strings.

src/_pytest/config/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import sys
1212
import types
1313
import warnings
14+
from distutils.version import LooseVersion
1415

1516
import py
1617
import six
@@ -816,9 +817,7 @@ def _checkversion(self):
816817

817818
minver = self.inicfg.get("minversion", None)
818819
if minver:
819-
ver = minver.split(".")
820-
myver = pytest.__version__.split(".")
821-
if myver < ver:
820+
if LooseVersion(minver) > LooseVersion(pytest.__version__):
822821
raise pytest.UsageError(
823822
"%s:%d: requires pytest-%s, actual pytest-%s'"
824823
% (

0 commit comments

Comments
 (0)