diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8878bb54..eeb64afa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,6 +54,7 @@ jobs: name: Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} needs: lint runs-on: ${{ matrix.os }} + timeout-minutes: 30 strategy: matrix: python-version: [3.11, 3.12, 3.13, 3.14, 3.15] @@ -80,11 +81,7 @@ jobs: id: run-pytests-with-code-coverage shell: bash run: | - if [[ "${{ runner.os }}" == "Windows" ]]; then - uv run pytest -n0 --cov kasa --cov-report xml - else - uv run pytest -n auto --cov kasa --cov-report xml - fi + uv run pytest -n auto --cov kasa --cov-report xml - name: Upload Code Coverage to Codecov id: upload-code-coverage-to-codecov diff --git a/pyproject.toml b/pyproject.toml index 65ca5e12..f048c8a1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -114,7 +114,10 @@ markers = [ "requires_dummy: test requires dummy data to pass, skipped on real devices", ] asyncio_mode = "auto" -asyncio_default_fixture_loop_scope = "function" +# One event loop for the run, not one per test: on Windows each loop opens a +# loopback TCP connection, and thousands of them use up the dynamic ports. +asyncio_default_fixture_loop_scope = "session" +asyncio_default_test_loop_scope = "session" #timeout = 10 # dist=loadgroup enables grouping of tests into single worker. # required as caplog doesn't play nicely with multiple workers.