(self)
| 265 | self._assert_isotime(calls[0][1][2], until) |
| 266 | |
| 267 | def test_wait_until_datetime(self): |
| 268 | extr = extractor.find("generic:https://example.org/") |
| 269 | until = dt.now() + dt.timedelta(seconds=5) |
| 270 | until_local = dt.datetime.now() + dt.timedelta(seconds=5) |
| 271 | |
| 272 | if not until.microsecond: |
| 273 | until = until.replace(microsecond=until_local.microsecond) |
| 274 | |
| 275 | with patch("time.sleep") as sleep, patch.object(extr, "log") as log: |
| 276 | extr.wait(until=until) |
| 277 | |
| 278 | calls = sleep.mock_calls |
| 279 | self.assertEqual(len(calls), 1) |
| 280 | self.assertAlmostEqual(calls[0][1][0], 6.0, places=1) |
| 281 | |
| 282 | calls = log.info.mock_calls |
| 283 | self.assertEqual(len(calls), 1) |
| 284 | self.assertEqual(calls[0][1][1], "5 seconds") |
| 285 | self._assert_isotime(calls[0][1][2], until_local) |
| 286 | |
| 287 | def _assert_isotime(self, output, until): |
| 288 | if not isinstance(until, dt.datetime): |
nothing calls this directly
no test coverage detected