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

Class RequesterThrottleTestCase

tests/Requester.py:566–585  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

564
565
566class RequesterThrottleTestCase(Framework.TestCase):
567 def setUp(self):
568 self.setPerPage(10)
569 super().setUp()
570
571 mock_time = [datetime.now(timezone.utc)]
572
573 def sleep(self, seconds):
574 self.mock_time[0] = self.mock_time[0] + timedelta(seconds=seconds)
575
576 def now(self, tz=None):
577 return self.mock_time[0]
578
579 @contextlib.contextmanager
580 def mock_sleep(self):
581 with mock.patch("github.Requester.time.sleep", side_effect=self.sleep) as sleep_mock, mock.patch(
582 "github.Requester.datetime"
583 ) as datetime_mock:
584 datetime_mock.now = self.now
585 yield sleep_mock
586
587
588class RequesterUnThrottled(RequesterThrottleTestCase):

Callers

nothing calls this directly

Calls 1

nowMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…