From 61d6e76142fa999effd15502127b95b1e85b2ce5 Mon Sep 17 00:00:00 2001 From: onerandomusername Date: Wed, 25 Sep 2024 17:40:12 -0400 Subject: [PATCH] run tests on windows --- .github/workflows/lint_test.yml | 4 ++-- tests/__init__.py | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint_test.yml b/.github/workflows/lint_test.yml index 64d6823e..c19ff6ed 100644 --- a/.github/workflows/lint_test.yml +++ b/.github/workflows/lint_test.yml @@ -168,7 +168,7 @@ jobs: # coverage report to github. - name: Run tests and generate coverage report id: run_tests - run: poetry run pytest tests -n auto --dist loadfile --cov --disable-warnings -q + run: python -m poetry run pytest tests -n auto --dist loadfile --cov --disable-warnings -q # This step will publish the coverage reports to coveralls.io and # print a "job" link in the output of the GitHub Action @@ -183,7 +183,7 @@ jobs: COVERALLS_FLAG_NAME: coverage-${{ runner.os }}-python-${{ env.PYTHON_VERSION }} COVERALLS_PARALLEL: true COVERALLS_SERVICE_NAME: github - run: poetry run coveralls + run: python -m poetry run coveralls coveralls-finish: name: Indicate completion to coveralls.io diff --git a/tests/__init__.py b/tests/__init__.py index e69de29b..9590dad1 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -0,0 +1,9 @@ +import asyncio +import os + + +# On windows aiodns's asyncio support relies on APIs like add_reader (which aiodns uses) +# are not guaranteed to be available, and in particular are not available when using the +# ProactorEventLoop on Windows, this method is only supported with Windows SelectorEventLoop +if os.name == "nt": + asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())