From 1568e38997ff6252e079c19e032c74abfe8b3f77 Mon Sep 17 00:00:00 2001 From: "Michael D. Hoyle" Date: Mon, 12 Nov 2018 16:20:15 -0500 Subject: [PATCH] Use pkg_resources.parse_version in minver check Use pkg_resources.parse_version in minver check Add meself to AUTHORS & changelog Format CHANGELOG --- AUTHORS | 1 + changelog/4315.trivial.rst | 1 + src/_pytest/config/__init__.py | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelog/4315.trivial.rst diff --git a/AUTHORS b/AUTHORS index 777eda324..1316f7b8f 100644 --- a/AUTHORS +++ b/AUTHORS @@ -158,6 +158,7 @@ Michael Droettboom Michael Seifert Michal Wajszczuk Mihai Capotă +Mike Hoyle (hoylemd) Mike Lundy Miro Hrončok Nathaniel Waisbrot diff --git a/changelog/4315.trivial.rst b/changelog/4315.trivial.rst new file mode 100644 index 000000000..ee7266aa0 --- /dev/null +++ b/changelog/4315.trivial.rst @@ -0,0 +1 @@ +Use ``pkg_resources.parse_version`` instead of ``LooseVersion`` in minversion check. diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index 0fc895546..7e24316ce 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -11,10 +11,10 @@ import shlex import sys import types import warnings -from distutils.version import LooseVersion import py import six +from pkg_resources import parse_version from pluggy import HookimplMarker from pluggy import HookspecMarker from pluggy import PluginManager @@ -822,7 +822,7 @@ class Config(object): minver = self.inicfg.get("minversion", None) if minver: - if LooseVersion(minver) > LooseVersion(pytest.__version__): + if parse_version(minver) > parse_version(pytest.__version__): raise pytest.UsageError( "%s:%d: requires pytest-%s, actual pytest-%s'" % (