I'm currently trying to get Project Foxhound to work well with WPT and found some WPT upstream bugs, I believe.
Issue
The first is that when session setup fails during setup in BiDi, the actual error is discarded, and pytest only reports StopAsyncIteration, i.e., dropping both the traceback and the actual cause.
Cause
From what I can see, the issue is in the following difference:
For Classic, if the creation fails the session function raises the caught exception again. For BiDi, no exception is raised in the handler.
Now, if something before the yield, e.g., bidi_session.start throws, the generator quits without ever yielding, with an empty return.
From the Python docs:
Calling the asynchronous iterator's
aiterator.__anext__ <object.__anext__> method
will return an awaitable which when awaited
will execute until it provides a value using the yield
expression. When the function executes an empty return
statement or falls off the end, a StopAsyncIteration exception
is raised and the asynchronous iterator will have reached the end of
the set of values to be yielded.
Suggested Fix
Add the raise to bidi_session, i.e.:
except Exception:
# Make sure we end up in a known state if something goes wrong.
global_fixtures.get_current_session().end()
+ raise
I'm currently trying to get Project Foxhound to work well with WPT and found some WPT upstream bugs, I believe.
Issue
The first is that when session setup fails during setup in BiDi, the actual error is discarded, and pytest only reports
StopAsyncIteration, i.e., dropping both the traceback and the actual cause.Cause
From what I can see, the issue is in the following difference:
For Classic, if the creation fails the
sessionfunction raises the caught exception again. For BiDi, no exception is raised in the handler.Now, if something before the yield, e.g., bidi_session.start throws, the generator quits without ever yielding, with an empty return.
From the Python docs:
Suggested Fix
Add the
raiseto bidi_session, i.e.: