Skip to content

Commit

Permalink
Patch monotonic in tests as on windows it can return same value
Browse files Browse the repository at this point in the history
  • Loading branch information
laky55555 committed Oct 18, 2022
1 parent 0369b5b commit f9a3cac
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/test_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -2195,9 +2195,11 @@ def test_never_expire(self, monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr("aiohttp.connector.monotonic", lambda: 10000000)
assert not dns_cache_table.expired("localhost")

def test_always_expire(self) -> None:
def test_always_expire(self, monkeypatch: pytest.MonkeyPatch) -> None:
dns_cache_table = _DNSCacheTable(ttl=0)
monkeypatch.setattr("aiohttp.connector.monotonic", lambda: 1)
dns_cache_table.add("localhost", ["127.0.0.1"])
monkeypatch.setattr("aiohttp.connector.monotonic", lambda: 1.00001)
assert dns_cache_table.expired("localhost")

def test_next_addrs(self, dns_cache_table: Any) -> None:
Expand Down

0 comments on commit f9a3cac

Please sign in to comment.