From 812a79481c15350746724f4f7aebf706c2a1297c Mon Sep 17 00:00:00 2001 From: JRoot Junior Date: Sat, 3 Aug 2024 17:31:39 +0300 Subject: [PATCH] Try to fix tests on Windows --- Makefile | 4 ++-- tests/conftest.py | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d08d0742..d079bb16 100644 --- a/Makefile +++ b/Makefile @@ -111,12 +111,12 @@ towncrier-build: .PHONY: towncrier-draft towncrier-draft: - towncrier build --draft + hatch run docs:towncrier build --draft .PHONY: towncrier-draft-github towncrier-draft-github: mkdir -p dist - towncrier build --draft | pandoc - -o dist/release.md + hatch run docs:towncrier build --draft | pandoc - -o dist/release.md .PHONY: prepare-release prepare-release: bump towncrier-build diff --git a/tests/conftest.py b/tests/conftest.py index 497dd50f..d739c59e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,3 +1,5 @@ +import asyncio +import sys from pathlib import Path import pytest @@ -37,6 +39,13 @@ def pytest_configure(config): config.addinivalue_line("markers", "mongo: marked tests require mongo connection to run") +@pytest.fixture(scope="module") +def event_loop_policy(request): + if sys.platform == "win32": + return asyncio.WindowsSelectorEventLoopPolicy() + return asyncio.DefaultEventLoopPolicy() + + @pytest.fixture() def redis_server(request): redis_uri = request.config.getoption("--redis")