MCPcopy
hub / github.com/urllib3/urllib3 / test_timeout_elapsed

Method test_timeout_elapsed

test/test_util.py:729–742  ·  view source on GitHub ↗
(self, time_monotonic: MagicMock)

Source from the content-addressed store, hash-verified

727
728 @patch("time.monotonic")
729 def test_timeout_elapsed(self, time_monotonic: MagicMock) -> None:
730 time_monotonic.return_value = TIMEOUT_EPOCH
731 timeout = Timeout(total=3)
732 with pytest.raises(TimeoutStateError):
733 timeout.get_connect_duration()
734
735 timeout.start_connect()
736 with pytest.raises(TimeoutStateError):
737 timeout.start_connect()
738
739 time_monotonic.return_value = TIMEOUT_EPOCH + 2
740 assert timeout.get_connect_duration() == 2
741 time_monotonic.return_value = TIMEOUT_EPOCH + 37
742 assert timeout.get_connect_duration() == 37
743
744 def test_is_fp_closed_object_supports_closed(self) -> None:
745 class ClosedFile:

Callers

nothing calls this directly

Calls 3

get_connect_durationMethod · 0.95
start_connectMethod · 0.95
TimeoutClass · 0.90

Tested by

no test coverage detected