MCPcopy Index your code
hub / github.com/PyGithub/PyGithub / test_primary_rate_error_with_reset

Method test_primary_rate_error_with_reset

tests/GithubRetry.py:136–162  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

134 yield
135
136 def test_primary_rate_error_with_reset(self):
137 retry = github.GithubRetry(total=3)
138 response = self.response_func(PrimaryRateLimitJson, 1644768012)
139 test_increment = self.get_test_increment_func(PrimaryRateLimitMessage)
140
141 # test 12 seconds before reset, note backoff will be 12+1 second
142 with self.mock_retry_now(1644768000):
143 retry = test_increment(
144 retry,
145 response(),
146 expected_total=2,
147 expected_backoff=12 + 1,
148 has_reset=True,
149 )
150 with self.mock_retry_now(1644768000):
151 retry = test_increment(
152 retry,
153 response(),
154 expected_total=1,
155 expected_backoff=12 + 1,
156 has_reset=True,
157 )
158
159 # test 2 seconds after reset, no backoff expected
160 with self.mock_retry_now(1644768014):
161 retry = test_increment(retry, response(), expected_total=0, expected_backoff=0)
162 test_increment(retry, response(), expect_retry_error=True)
163
164 def test_primary_rate_error_with_reset_and_exponential_backoff(self):
165 retry = github.GithubRetry(total=3, backoff_factor=10)

Callers

nothing calls this directly

Calls 3

response_funcMethod · 0.95
mock_retry_nowMethod · 0.95

Tested by

no test coverage detected