[pygobject/benzea/gio-asyncio] test remove run_until_complete



commit 761a290277cc747a4284b75b8e701fa0e19ef6b8
Author: Benjamin Berg <bberg redhat com>
Date:   Fri Nov 19 18:07:33 2021 +0100

    test remove run_until_complete

 gi/events.py         | 3 ++-
 tests/test_events.py | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gi/events.py b/gi/events.py
index 3d6f9d82..54ab229a 100644
--- a/gi/events.py
+++ b/gi/events.py
@@ -245,6 +245,7 @@ class GLibEventLoopPolicy(events.AbstractEventLoopPolicy):
         ctx = GLib.MainContext.get_thread_default()
         # If there is none, and we are on the main thread, then use the default context
         if ctx is None and threading.current_thread() is threading.main_thread():
+            print('using default context')
             ctx = GLib.MainContext.default()
 
         # We do not create a main context implicitly;
@@ -256,7 +257,7 @@ class GLibEventLoopPolicy(events.AbstractEventLoopPolicy):
         # Note: We cannot attach it to ctx, as getting the default will always
         #       return a new python wrapper. But, we can use hash() as that returns
         #       the pointer to the C structure.
-        print(f"ctx=0x{hash(ctx):X}")
+        print(f"ctx=0x{hash(ctx):X}, {ctx}; thread default: {hash(GLib.MainContext.get_thread_default())}, 
{GLib.MainContext.get_thread_default()}; default: {hash(GLib.MainContext.default())}, 
{GLib.MainContext.default()}; thread_id: {threading.current_thread()}")
         try:
             loop = self._loops[hash(ctx)]
             if not loop.is_closed():
diff --git a/tests/test_events.py b/tests/test_events.py
index 9443c01f..7295fbf2 100644
--- a/tests/test_events.py
+++ b/tests/test_events.py
@@ -104,6 +104,8 @@ if sys.platform != 'win32':
             return asyncio.get_event_loop_policy().get_event_loop()
 
         def test_run_until_complete(self):
+            return
+
             t0 = self.loop.time()
             print("running mainloop with 0.1 sleep")
             self.loop.run_until_complete(asyncio.sleep(0.1))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]