From a5ab7c19fb44cc5177faea95a8f2322af6f2b415 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Fri, 12 Jun 2020 16:26:33 +0300 Subject: [PATCH] config: reject minversion if it's a list instead of a single string Fixes: src/_pytest/config/__init__.py:1071: error: Argument 1 to "Version" has incompatible type "Union[str, List[str]]"; expected "str" [arg-type] --- src/_pytest/config/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index e154f162b..7dff52c67 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -1067,6 +1067,11 @@ class Config: # Imported lazily to improve start-up time. from packaging.version import Version + if not isinstance(minver, str): + raise pytest.UsageError( + "%s: 'minversion' must be a single value" % self.inifile + ) + if Version(minver) > Version(pytest.__version__): raise pytest.UsageError( "%s: 'minversion' requires pytest-%s, actual pytest-%s'"