Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Test vanilla event loop windows #180

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
7 changes: 0 additions & 7 deletions src/synchronicity/synchronizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import functools
import inspect
import os
import platform
import threading
import types
import typing
Expand Down Expand Up @@ -106,12 +105,6 @@ def __init__(
self._owner_pid = None
self._stopping = None

if platform.system() == "Windows":
# default event loop policy on windows spits out errors when
# closing the event loop, so use WindowsSelectorEventLoopPolicy instead
# https://stackoverflow.com/questions/45600579/asyncio-event-loop-is-closed-when-getting-loop
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

# Special attribute we use to go from wrapped <-> original
self._wrapped_attr = "_sync_wrapped_%d" % id(self)
self._original_attr = "_sync_original_%d" % id(self)
Expand Down
3 changes: 3 additions & 0 deletions test/gevent_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@


@pytest.mark.skipif(sys.version_info >= (3, 13), reason="gevent seems broken on Python 3.13")
@pytest.mark.skipif(
sys.platform == "win32", reason="gevent support broken on Windows, probably due to event loop patching"
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh, not sure how important gevent support is these days, but maybe there are still libraries making use of it?

I feel I'd rather have synchronicity be on the default event loop implementation to prevent potential inconsistencies of using a different one?

def test_gevent():
# Run it in a separate process because gevent modifies a lot of modules
fn = Path(__file__).parent / "support" / "_gevent.py"
Expand Down
4 changes: 1 addition & 3 deletions test/shutdown_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ def test_shutdown():
p.stdout.readline() == "keyboard interrupt\n"
) # we want the keyboard interrupt to come *after* the running function has been cancelled!

stderr_content = p.stderr.read()
print("stderr:", stderr_content)
assert "Traceback" not in stderr_content
assert p.stderr.read().strip() == ""


def test_keyboard_interrupt_reraised_as_is(synchronizer):
Expand Down