Skip to content

Commit

Permalink
fix: adjust ci coverage and 3.12 support
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewthetechie committed May 8, 2024
1 parent b1bb5d3 commit 1cfe1e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions pydantic_aioredis/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ def bytes_to_string(data: bytes):


class NestedAsyncIO:
"""Patch asyncio to allow nested event loops."""

__slots__ = [
"_loop",
"orig_run",
Expand Down Expand Up @@ -106,10 +104,11 @@ def _get_event_loop(stacklevel=3):
asyncio.all_tasks = asyncio.tasks.Task.all_tasks
elif sys.version_info >= (3, 9, 0):
self.orig_get_loops = {
"events__get_event_loop": events._get_event_loop,
"events_get_event_loop": events.get_event_loop,
"asyncio_get_event_loop": asyncio.get_event_loop,
}
if sys.version_info <= (3, 12, 0):
self.orig_get_loops["events__get_event_loop"] = (events._get_event_loop,)
events._get_event_loop = events.get_event_loop = asyncio.get_event_loop = _get_event_loop
self.orig_run = asyncio.run
asyncio.run = run
Expand Down Expand Up @@ -308,6 +307,6 @@ def patch_tornado(self):

def unpatch_tornado(self):
if self.orig_tc:
import tornado.concurrent as tc # noqa
import tornado.concurrent as tc

tc.Future = self.orig_tc
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ build-backend = "poetry.core.masonry.api"
exclude_dirs = ["test", "noxfile.py", ".github/scripts", "dist", "examples/*"]

[tool.pytest.ini_options]
addopts = "-n 4 --ignore examples --cov=pydantic_aioredis --cov-report xml:.coverage.xml --cov-report=term-missing --cov-fail-under 91"
addopts = "-n 4 --ignore examples --cov=pydantic_aioredis --cov-report xml:.coverage.xml --cov-report=term-missing --cov-fail-under 85"

[tool.ruff]
line-length = 120
target-version = "py37"
target-version = "py38"

0 comments on commit 1cfe1e4

Please sign in to comment.