diff options
author | rahulp13 | 2020-02-28 11:38:58 +0530 |
---|---|---|
committer | rahulp13 | 2020-02-28 11:38:58 +0530 |
commit | 246319682f60293b132fca1ce6e24689c6682617 (patch) | |
tree | 6871b758a17869efecfd617f5513e31f9a933f4a /Windows/dateutil/test/conftest.py | |
parent | d9ab84106cac311d953f344386fef1c1e2bca1cf (diff) | |
download | eSim-246319682f60293b132fca1ce6e24689c6682617.tar.gz eSim-246319682f60293b132fca1ce6e24689c6682617.tar.bz2 eSim-246319682f60293b132fca1ce6e24689c6682617.zip |
initial commit
Diffstat (limited to 'Windows/dateutil/test/conftest.py')
-rw-r--r-- | Windows/dateutil/test/conftest.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Windows/dateutil/test/conftest.py b/Windows/dateutil/test/conftest.py new file mode 100644 index 00000000..78ed70ac --- /dev/null +++ b/Windows/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() |