Skip to content

Commit a3ec28c

Browse files
committed
get test_nested_class_definition_inside_async_function working on emscripten and wasi
1 parent e55fc84 commit a3ec28c

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

Lib/test/test_inspect/test_inspect.py

+12-7
Original file line numberDiff line numberDiff line change
@@ -1160,15 +1160,20 @@ def f(self):
11601160
# This is necessary when the test is run multiple times.
11611161
sys.modules.pop("inspect_actual")
11621162

1163-
@unittest.skipIf(
1164-
support.is_emscripten or support.is_wasi,
1165-
"socket.accept is broken"
1166-
)
11671163
def test_nested_class_definition_inside_async_function(self):
1168-
import asyncio
1169-
self.assertSourceEqual(asyncio.run(mod2.func225(), loop_factory=asyncio.EventLoop), 226, 227)
1164+
def run(coro):
1165+
try:
1166+
coro.send(None)
1167+
except StopIteration as e:
1168+
return e.value
1169+
else:
1170+
raise RuntimeError("coroutine did not complete synchronously!")
1171+
finally:
1172+
coro.close()
1173+
1174+
self.assertSourceEqual(run(mod2.func225()), 226, 227)
11701175
self.assertSourceEqual(mod2.cls226, 231, 235)
1171-
self.assertSourceEqual(asyncio.run(mod2.cls226().func232(), loop_factory=asyncio.EventLoop), 233, 234)
1176+
self.assertSourceEqual(run(mod2.cls226().func232()), 233, 234)
11721177

11731178
def test_class_definition_same_name_diff_methods(self):
11741179
self.assertSourceEqual(mod2.cls296, 296, 298)

0 commit comments

Comments
 (0)