From 64b0a768f2ba952cd7bdf2f938e85bc046b783cb Mon Sep 17 00:00:00 2001 From: simonfagerholm Date: Mon, 23 Mar 2020 10:59:06 +0100 Subject: [PATCH 1/4] Enable test_subprocess to be run on win, by changing to ProactorEventLoop in those tests. --- tests/test_subprocess.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_subprocess.py b/tests/test_subprocess.py index 3f3fa090..83490e82 100644 --- a/tests/test_subprocess.py +++ b/tests/test_subprocess.py @@ -6,6 +6,17 @@ import pytest +if sys.platform == 'win32': + # The default asyncio event loop implementation on Windows does not + # support subprocesses. Subprocesses are available for Windows if a + # ProactorEventLoop is used. + @pytest.yield_fixture() + def event_loop(): + loop = asyncio.ProactorEventLoop() + yield loop + loop.close() + + @pytest.mark.asyncio(forbid_global_loop=False) async def test_subprocess(event_loop): """Starting a subprocess should be possible.""" From d788481ac23b862d04a981a6ad27db4fe636023f Mon Sep 17 00:00:00 2001 From: simonfagerholm Date: Mon, 23 Mar 2020 11:01:49 +0100 Subject: [PATCH 2/4] Change event_loop to module scope in hypothesis tests, fixing #145. --- tests/test_hypothesis_integration.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_hypothesis_integration.py b/tests/test_hypothesis_integration.py index 63c6cc74..b4e62a0e 100644 --- a/tests/test_hypothesis_integration.py +++ b/tests/test_hypothesis_integration.py @@ -8,6 +8,12 @@ from hypothesis import given, strategies as st +@pytest.fixture(scope="module") +def event_loop(): + loop = asyncio.get_event_loop() + yield loop + + @given(st.integers()) @pytest.mark.asyncio async def test_mark_inner(n): From 4d8f5d7f7f6cc1ae2be2a092de77b7b86be481eb Mon Sep 17 00:00:00 2001 From: simonfagerholm Date: Mon, 23 Mar 2020 11:03:22 +0100 Subject: [PATCH 3/4] Add max supported pytest version to < 5.4.0 to prevent fails until #141 is fixed. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 8c074a24..bb5cf0ad 100644 --- a/setup.py +++ b/setup.py @@ -40,7 +40,7 @@ def find_version(): "Framework :: Pytest", ], python_requires=">= 3.5", - install_requires=["pytest >= 3.6.0"], + install_requires=["pytest >= 3.6.0, < 5.4.0"], extras_require={ ':python_version == "3.5"': "async_generator >= 1.3", "testing": [ From 4e71ec23445fbf1d457f2bead1de8b02a3fc19f1 Mon Sep 17 00:00:00 2001 From: simonfagerholm Date: Tue, 24 Mar 2020 07:02:00 +0100 Subject: [PATCH 4/4] Added min hypothesis version so that bugfix for https://github.com/HypothesisWorks/hypothesis/issues/2375 is installed, solving build issues. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index bb5cf0ad..8d80b08e 100644 --- a/setup.py +++ b/setup.py @@ -46,7 +46,7 @@ def find_version(): "testing": [ "coverage", "async_generator >= 1.3", - "hypothesis >= 3.64", + "hypothesis >= 5.7.1", ], }, entry_points={"pytest11": ["asyncio = pytest_asyncio.plugin"]},