Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix CI #148

Merged
merged 6 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pytest_subprocess/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
from typing import Optional
from typing import Sequence
from typing import Tuple
from typing import TYPE_CHECKING
from typing import Union

if TYPE_CHECKING:
from .types import COMMAND

ARGUMENT = Union[str, "Any", os.PathLike]


Expand All @@ -31,7 +35,7 @@ class Command:

def __init__(
self,
command: Union[Sequence[ARGUMENT], str],
command: "COMMAND",
):
if isinstance(command, str):
command = tuple(command.split(" "))
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ignore = E231,W503
max-line-length = 89

[mypy]
python_version = 3.6
python_version = 3.8
warn_return_any = True
warn_unused_configs = True
disallow_untyped_defs = True
Expand Down
27 changes: 14 additions & 13 deletions tests/test_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,23 @@
PYTHON = sys.executable


@pytest.fixture(autouse=True)
def event_loop(request):
@pytest.fixture()
def event_loop_policy(request):
if sys.platform.startswith("win"):
if request.node.name.startswith("test_invalid_event_loop"):
loop = asyncio.SelectorEventLoop()
return asyncio.WindowsSelectorEventLoopPolicy()
else:
loop = asyncio.ProactorEventLoop()
elif sys.version_info.minor < 7:
loop = asyncio.get_event_loop()
else:
try:
loop = asyncio.get_running_loop()
except RuntimeError:
loop = asyncio.new_event_loop()
yield loop
loop.close()
return asyncio.WindowsProactorEventLoopPolicy()
return asyncio.DefaultEventLoopPolicy()


if sys.platform.startswith("win") and sys.version_info < (3, 8):

@pytest.fixture(autouse=True)
def event_loop(request, event_loop_policy):
loop = event_loop_policy.new_event_loop()
yield loop
loop.close()


@pytest.mark.asyncio
Expand Down
Loading