forked from pool/python-pyee
- Fix pytest section in pyproject.toml.
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pyee?expand=0&rev=33
This commit is contained in:
98
gh-pr184_tests.patch
Normal file
98
gh-pr184_tests.patch
Normal file
@@ -0,0 +1,98 @@
|
||||
From 1b229fadbadf3c5d94b0a9a53461ea7157bb1bff Mon Sep 17 00:00:00 2001
|
||||
From: Josh Holbrook <josh.holbrook@gmail.com>
|
||||
Date: Mon, 26 May 2025 11:18:43 -0800
|
||||
Subject: [PATCH 1/2] Remove fixture from trio test
|
||||
|
||||
---
|
||||
tests/test_trio.py | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/tests/test_trio.py b/tests/test_trio.py
|
||||
index 4ac814c..3edc54f 100644
|
||||
--- a/tests/test_trio.py
|
||||
+++ b/tests/test_trio.py
|
||||
@@ -12,7 +12,7 @@ class PyeeTestError(Exception):
|
||||
|
||||
|
||||
@pytest.mark.trio
|
||||
-async def test_trio_emit():
|
||||
+async def test_trio_emit() -> None:
|
||||
"""Test that the trio event emitter can handle wrapping
|
||||
coroutines
|
||||
"""
|
||||
@@ -35,7 +35,7 @@ async def event_handler():
|
||||
|
||||
|
||||
@pytest.mark.trio
|
||||
-async def test_trio_once_emit():
|
||||
+async def test_trio_once_emit() -> None:
|
||||
"""Test that trio event emitters also wrap coroutines when
|
||||
using once
|
||||
"""
|
||||
@@ -58,7 +58,7 @@ async def event_handler():
|
||||
|
||||
|
||||
@pytest.mark.trio
|
||||
-async def test_trio_error():
|
||||
+async def test_trio_error() -> None:
|
||||
"""Test that trio event emitters can handle errors when
|
||||
wrapping coroutines
|
||||
"""
|
||||
@@ -86,7 +86,7 @@ async def handle_error(exc):
|
||||
|
||||
|
||||
@pytest.mark.trio
|
||||
-async def test_sync_error(event_loop):
|
||||
+async def test_sync_error() -> None:
|
||||
"""Test that regular functions have the same error handling as coroutines"""
|
||||
|
||||
async with TrioEventEmitter() as ee:
|
||||
|
||||
From b1624101d42df56177f6b6461e73c20039cb9b92 Mon Sep 17 00:00:00 2001
|
||||
From: Josh Holbrook <josh.holbrook@gmail.com>
|
||||
Date: Mon, 26 May 2025 11:24:41 -0800
|
||||
Subject: [PATCH 2/2] Type check trio tests
|
||||
|
||||
---
|
||||
tests/test_trio.py | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/tests/test_trio.py b/tests/test_trio.py
|
||||
index 3edc54f..5c42ec8 100644
|
||||
--- a/tests/test_trio.py
|
||||
+++ b/tests/test_trio.py
|
||||
@@ -1,5 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
+from typing import NoReturn
|
||||
+
|
||||
import pytest
|
||||
import pytest_trio.plugin # type: ignore # noqa
|
||||
import trio
|
||||
@@ -64,7 +66,7 @@ async def test_trio_error() -> None:
|
||||
"""
|
||||
|
||||
async with TrioEventEmitter() as ee:
|
||||
- send, rcv = trio.open_memory_channel(1)
|
||||
+ send, rcv = trio.open_memory_channel[PyeeTestError](1)
|
||||
|
||||
@ee.on("event")
|
||||
async def event_handler():
|
||||
@@ -90,14 +92,14 @@ async def test_sync_error() -> None:
|
||||
"""Test that regular functions have the same error handling as coroutines"""
|
||||
|
||||
async with TrioEventEmitter() as ee:
|
||||
- send, rcv = trio.open_memory_channel(1)
|
||||
+ send, rcv = trio.open_memory_channel[PyeeTestError](1)
|
||||
|
||||
@ee.on("event")
|
||||
- def sync_handler():
|
||||
+ def sync_handler() -> NoReturn:
|
||||
raise PyeeTestError()
|
||||
|
||||
@ee.on("error")
|
||||
- async def handle_error(exc):
|
||||
+ async def handle_error(exc) -> None:
|
||||
async with send:
|
||||
await send.send(exc)
|
||||
|
||||
Reference in New Issue
Block a user