MCPcopy Create free account
hub / github.com/dateutil/dateutil / TzSourceMixin

Class TzSourceMixin

tests/_common.py:105–127  ·  view source on GitHub ↗

Runs the tests in a TestCase against a single source of time zone data. unittest.TestCase subclasses can't use parametrized pytest fixtures, so to run a set of tests against more than one source, subclass the test case and override ``tz_source``. A ``tz_source`` of None leaves everythin

Source from the content-addressed store, hash-verified

103
104
105class TzSourceMixin:
106 """Runs the tests in a TestCase against a single source of time zone data.
107
108 unittest.TestCase subclasses can't use parametrized pytest fixtures, so to
109 run a set of tests against more than one source, subclass the test case
110 and override ``tz_source``. A ``tz_source`` of None leaves everything as
111 it is.
112 """
113
114 tz_source = "tzpath"
115
116 def setUp(self):
117 super().setUp()
118 if self.tz_source is None:
119 return
120
121 reason = tz_source_skip_reason(self.tz_source)
122 if reason is not None:
123 self.skipTest(reason)
124
125 context = tz_source_context(self.tz_source)
126 context.__enter__()
127 self.addCleanup(context.__exit__, None, None, None)
128
129
130class PicklableMixin:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected