Skip to content

Commit

Permalink
CI: Run unit tests on Windows (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
francis-clairicia authored Nov 12, 2023
1 parent 7d24046 commit d110228
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
comment:
require_changes: false # Always show messages if codecov is triggered
layout: "flags" # Only show coverage by flags
after_n_builds: 8 # nb_tested_python_version(==2) * (nb_tested_platforms(==3) + nb_unit_test_runs(==1))
after_n_builds: 10 # nb_tested_python_version(==2) * (nb_functional_test_runs(==3) + nb_unit_test_runs(==2))
coverage:
status:
project:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ jobs:
if: |
(github.event_name != 'push' || !startsWith(github.event.head_commit.message, 'Bump version:'))
&& (github.event_name != 'pull_request' || github.event.pull_request.draft != true)
runs-on: ubuntu-22.04
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-2022]
python_version: ['3.11', '3.12']

steps:
Expand Down
6 changes: 1 addition & 5 deletions src/easynetwork/lowlevel/asyncio/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,7 @@ def get_cancelled_exc_class(self) -> type[BaseException]:
async def ignore_cancellation(self, coroutine: Coroutine[Any, Any, _T_co]) -> _T_co:
if not asyncio.iscoroutine(coroutine):
raise TypeError("Expected a coroutine object")
if sys.version_info >= (3, 12):
context = TaskUtils.current_asyncio_task().get_context()
else:
context = None
return await TaskUtils.cancel_shielded_await_task(asyncio.create_task(coroutine, context=context))
return await TaskUtils.cancel_shielded_await_task(asyncio.create_task(coroutine))

def open_cancel_scope(self, *, deadline: float = math.inf) -> CancelScope:
return CancelScope(deadline=deadline)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,6 @@ async def self_cancellation() -> None:
await task
assert task.cancelled()

@pytest.mark.xfail("sys.version_info < (3, 12)", reason="asyncio.Task.get_context() does not exist before Python 3.12")
async def test____ignore_cancellation____share_same_context_with_host_task(
self,
backend: AsyncIOBackend,
) -> None:
async def coroutine() -> None:
await asyncio.sleep(0.1)

cvar_for_test.set("after_in_coroutine")

cvar_for_test.set("before_in_current_task")
await backend.ignore_cancellation(coroutine())

assert cvar_for_test.get() == "after_in_coroutine"

async def test____timeout____respected(
self,
backend: AsyncIOBackend,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

from pytest_mock import MockerFixture

from ....tools import PlatformMarkers
from ...base import BaseTestSocket


Expand Down Expand Up @@ -530,6 +531,7 @@ async def test____serve____connect____error_raised(
exc,
)

@PlatformMarkers.skipif_platform_win32
@pytest.mark.parametrize("errno_value", sorted(ACCEPT_CAPACITY_ERRNOS), ids=errno_errorcode.__getitem__)
async def test____serve____accept_capacity_error(
self,
Expand Down

0 comments on commit d110228

Please sign in to comment.