summaryrefslogtreecommitdiffstats
path: root/contrib/python/python-dateutil/py3/tests/conftest.py
diff options
context:
space:
mode:
authorAlexSm <[email protected]>2024-03-18 18:53:07 +0100
committerGitHub <[email protected]>2024-03-18 18:53:07 +0100
commit5bbead84c5a9b7d3c3b2f71e14bc9a34631d3048 (patch)
tree8a4df05f6917d6130e8290110d1a32217911d388 /contrib/python/python-dateutil/py3/tests/conftest.py
parente3af273efaef7dfa21205278f17cd164e247820d (diff)
parent008975f6d232e7b8e802f385a48441e123712248 (diff)
Merge pull request #2873 from ydb-platform/mergelibs-240318-0944
Library import 240318-0944
Diffstat (limited to 'contrib/python/python-dateutil/py3/tests/conftest.py')
-rw-r--r--contrib/python/python-dateutil/py3/tests/conftest.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/contrib/python/python-dateutil/py3/tests/conftest.py b/contrib/python/python-dateutil/py3/tests/conftest.py
new file mode 100644
index 00000000000..78ed70acb3c
--- /dev/null
+++ b/contrib/python/python-dateutil/py3/tests/conftest.py
@@ -0,0 +1,41 @@
+import os
+import pytest
+
+
+# Configure pytest to ignore xfailing tests
+# 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
+ if marker_getter is None:
+ marker_getter = item.get_marker
+
+ marker = marker_getter('xfail')
+
+ # Need to query the args because conditional xfail tests still have
+ # the xfail mark even if they are not expected to fail
+ if marker and (not marker.args or marker.args[0]):
+ item.add_marker(pytest.mark.no_cover)
+
+
+def set_tzpath():
+ """
+ Sets the TZPATH variable if it's specified in an environment variable.
+ """
+ tzpath = os.environ.get('DATEUTIL_TZPATH', None)
+
+ if tzpath is None:
+ return
+
+ path_components = tzpath.split(':')
+
+ print("Setting TZPATH to {}".format(path_components))
+
+ from dateutil import tz
+ tz.TZPATHS.clear()
+ tz.TZPATHS.extend(path_components)
+
+
+set_tzpath()