Skip to content

Commit

Permalink
Fix unit tests on Python 3.13
Browse files Browse the repository at this point in the history
Python 3.13 uses time.time_ns() to get timestamps for logging, so extend
the mock of time.time() to also mock time.time.ns().
  • Loading branch information
bmerry committed Oct 24, 2024
1 parent a8db0a3 commit a86cfe9
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ async def get_version_info(
@pytest.fixture
def mock_time(mocker, event_loop) -> None:
mocker.patch("time.time", lambda: event_loop.time() + 123456789.0)
mocker.patch("time.time_ns", lambda: event_loop.time() * 1e9 + 123456789e9)


async def test_start_twice(server: DummyServer) -> None:
Expand Down

0 comments on commit a86cfe9

Please sign in to comment.