diff --git a/githubkit/core.py b/githubkit/core.py index 108f05625..82fbf997f 100644 --- a/githubkit/core.py +++ b/githubkit/core.py @@ -4,7 +4,7 @@ from datetime import datetime, timedelta, timezone import time from types import TracebackType -from typing import TYPE_CHECKING, Any, Generic, TypeVar, cast, overload +from typing import TYPE_CHECKING, Any, Generic, TypeVar, overload import anyio import httpx diff --git a/tests/test_unit_test/test_unit_test.py b/tests/test_unit_test/test_unit_test.py index 86892f9bf..455c15831 100644 --- a/tests/test_unit_test/test_unit_test.py +++ b/tests/test_unit_test/test_unit_test.py @@ -1,7 +1,7 @@ +from datetime import timedelta import json from pathlib import Path import threading -from datetime import timedelta from typing import Any, TypeVar from githubkit_schemas.latest.models import FullRepository @@ -110,6 +110,7 @@ def test_mem_cache_passive_expiry(): cache.set("key2", "val2", timedelta(hours=1)) import time + time.sleep(0.01) assert cache.get("key1") is None @@ -119,10 +120,9 @@ def test_mem_cache_passive_expiry(): def test_core_context_manager_safety(): gh = GitHubCore() - with pytest.raises(RuntimeError): - with gh: - with gh: - pass + with gh: + with pytest.raises(RuntimeError): + gh.__enter__() # Ensure no lingering client after error assert gh._GitHubCore__sync_client.get() is None