diff --git a/_pytest/python.py b/_pytest/python.py index b7c102a69..cdd51a810 100644 --- a/_pytest/python.py +++ b/_pytest/python.py @@ -9,6 +9,12 @@ import pytest from _pytest.mark import MarkDecorator, MarkerError from py._code.code import TerminalRepr +try: + import enum +except ImportError: # pragma: no cover + # Only available in Python 3.4+ or as a backport + enum = None + import _pytest import pluggy @@ -980,12 +986,6 @@ def _idval(val, argname, idx, idfn): except Exception: pass - try: - import enum - except ImportError: - # Only available in Python 3.4+ - enum = None - if isinstance(val, (float, int, str, bool, NoneType)): return str(val) elif isinstance(val, REGEX_TYPE):