aboutsummaryrefslogtreecommitdiff
path: root/dateutil
diff options
context:
space:
mode:
authorNicolas Evrard <nicoe@openhex.org>2019-01-31 21:39:06 +0100
committerPaul Ganssle <paul@ganssle.io>2019-02-02 10:40:54 -0500
commita9f6d7410b0e22d063557e15f1ce291882d4745a (patch)
tree878cc5c64d72c9a1e1e3c4ca7bcdabea201791a5 /dateutil
parent6618dee970ec1e5f92e0f48ec74584caf13075aa (diff)
downloaddateutil-a9f6d7410b0e22d063557e15f1ce291882d4745a.tar.gz
Short circuit evaluation of pytest get_marker
No version of pytest that works on Python 3.3 supports the get_closest_marker method, and pytest >= 4.0 *only* supports get_closest_marker, so we must retrieve item.get_marker *if and only if* we cannot retrieve get_closest_marker.
Diffstat (limited to 'dateutil')
-rw-r--r--dateutil/test/conftest.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/dateutil/test/conftest.py b/dateutil/test/conftest.py
index 3876b4d..78ed70a 100644
--- a/dateutil/test/conftest.py
+++ b/dateutil/test/conftest.py
@@ -6,9 +6,11 @@ import pytest
# See: https://stackoverflow.com/a/53198349/467366
def pytest_collection_modifyitems(items):
for item in items:
+ marker_getter = getattr(item, 'get_closest_marker', None)
+
# Python 3.3 support
- marker_getter = getattr(item, 'get_closest_marker',
- getattr(item, 'get_marker'))
+ if marker_getter is None:
+ marker_getter = item.get_marker
marker = marker_getter('xfail')