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

Method __enter__

tests/_common.py:208–217  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

206 gval=cls._guard_allows_change)
207
208 def __enter__(self):
209 if not self.tz_change_allowed():
210 msg = self.tz_change_disallowed_message()
211 pytest.skip(msg)
212
213 # If this is used outside of a test suite, we still want an error.
214 raise ValueError(msg) # pragma: no cover
215
216 self._old_tz = self.get_current_tz()
217 self.set_current_tz(self.tzval)
218
219 def __exit__(self, type, value, traceback):
220 if self._old_tz is not None:

Callers 1

setUpMethod · 0.45

Calls 4

tz_change_allowedMethod · 0.95
get_current_tzMethod · 0.95
set_current_tzMethod · 0.95

Tested by

no test coverage detected