Skip to content

Commit

Permalink
chore(ci): Reapply the python version setting for ruff in a different…
Browse files Browse the repository at this point in the history
… section of pyproject.toml
  • Loading branch information
achimnol committed Feb 1, 2024
1 parent 85cc8fe commit 6d8a93e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ select = [
]
ignore = ["E203","E731","E501"]
preview = true
target-version = "py311"

[tool.ruff.isort]
known-first-party = ["aiotools"]
Expand Down
19 changes: 11 additions & 8 deletions src/aiotools/timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,16 @@ def patch_loop(self):
so that sleep instantly returns while proceeding the virtual clock.
"""
loop = get_running_loop()
with mock.patch.object(
loop._selector,
"select",
new=functools.partial(self._virtual_select, loop._selector.select),
), mock.patch.object(
loop,
"time",
new=self.virtual_time,
with (
mock.patch.object(
loop._selector,
"select",
new=functools.partial(self._virtual_select, loop._selector.select),
),
mock.patch.object(
loop,
"time",
new=self.virtual_time,
),
):
yield
11 changes: 7 additions & 4 deletions tests/test_ptaskgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,13 @@ async def handler(exc_type, exc_obj, exc_tb):

loop = aiotools.compat.get_running_loop()
vclock = aiotools.VirtualClock()
with vclock.patch_loop(), mock.patch.object(
loop,
"call_exception_handler",
mock.MagicMock(),
with (
vclock.patch_loop(),
mock.patch.object(
loop,
"call_exception_handler",
mock.MagicMock(),
),
):
# Errors in exception handlers are covered by the event loop's exception
# handler, so that they can be reported as soon as possible when they occur.
Expand Down

0 comments on commit 6d8a93e

Please sign in to comment.