diff options
author | shadchin <shadchin@yandex-team.com> | 2023-10-10 11:35:31 +0300 |
---|---|---|
committer | shadchin <shadchin@yandex-team.com> | 2023-10-10 11:54:48 +0300 |
commit | 656bb1fb2814e586db5de6166ebbb17363d5325b (patch) | |
tree | 31b755ba74120fea597c6d00ce9ff1d0ca7b728a /contrib/python/python-dateutil/py3/dateutil/test/conftest.py | |
parent | 3896b7591b5f3231ceb4bfe69cf9863b237d8b78 (diff) | |
download | ydb-656bb1fb2814e586db5de6166ebbb17363d5325b.tar.gz |
Split python-dateutil on py2/py3
Diffstat (limited to 'contrib/python/python-dateutil/py3/dateutil/test/conftest.py')
-rw-r--r-- | contrib/python/python-dateutil/py3/dateutil/test/conftest.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/contrib/python/python-dateutil/py3/dateutil/test/conftest.py b/contrib/python/python-dateutil/py3/dateutil/test/conftest.py new file mode 100644 index 00000000000..78ed70acb3c --- /dev/null +++ b/contrib/python/python-dateutil/py3/dateutil/test/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() |