You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We intend to update pytest-asyncio to the latest release (0.23.5.post1) in Fedora. Testing packages that depend on it, showed pytest-subprocess tests failing, because warnings are turned into errors as per:
====================================ERRORS====================================__________________ERRORatsetupoftest_basic_usage[shell] ___________________fixturedef=<FixtureDefargname='event_loop'scope='function'baseid='tests/test_asyncio.py'>
@pytest.hookimpl(hookwrapper=True)
defpytest_fixture_setup(
fixturedef: FixtureDef,
) ->Generator[None, Any, None]:
"""Adjust the event loop policy when an event loop is produced."""iffixturedef.argname=="event_loop":
# The use of a fixture finalizer is preferred over the# pytest_fixture_post_finalizer hook. The fixture finalizer is invoked once# for each fixture, whereas the hook may be invoked multiple times for# any specific fixture.# see https://github.com/pytest-dev/pytest/issues/5848_add_finalizers(
fixturedef,
_close_event_loop,
_restore_event_loop_policy(asyncio.get_event_loop_policy()),
_provide_clean_event_loop,
)
outcome=yieldloop: asyncio.AbstractEventLoop=outcome.get_result()
# Weird behavior was observed when checking for an attribute of FixtureDef.func# Instead, we now check for a special attribute of the returned event loopfixture_filename=inspect.getsourcefile(fixturedef.func)
ifnotgetattr(loop, "__original_fixture_loop", False):
_, fixture_line_number=inspect.getsourcelines(fixturedef.func)
>warnings.warn(
_REDEFINED_EVENT_LOOP_FIXTURE_WARNING% (fixture_filename, fixture_line_number),
DeprecationWarning,
)
EDeprecationWarning: Theevent_loopfixtureprovidedbypytest-asynciohasbeenredefinedinE/builddir/build/BUILD/pytest-subprocess-1.5.0/tests/test_asyncio.py:14EReplacingtheevent_loopfixturewithacustomimplementationisdeprecatedEandwillleadtoerrorsinthefuture.
EIfyouwanttorequestanasyncioeventloopwithascopeotherthanfunctionEscope, usethe"scope"argumenttotheasynciomarkwhenmarkingthetests.
EIfyouwanttoreturndifferenttypesofeventloops, usetheevent_loop_policyEfixture.
/usr/lib/python3.12/site-packages/pytest_asyncio/plugin.py:769: DeprecationWarning_________________ERRORatteardownoftest_basic_usage[shell] _________________def_close_event_loop() ->None:
policy=asyncio.get_event_loop_policy()
try:
>loop=policy.get_event_loop()
/usr/lib/python3.12/site-packages/pytest_asyncio/plugin.py:823:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self=<asyncio.unix_events._UnixDefaultEventLoopPolicyobjectat0x7fd70d9466c0>defget_event_loop(self):
"""Get the event loop for the current context. Returns an instance of EventLoop or raises an exception. """if (self._local._loopisNoneandnotself._local._set_calledandthreading.current_thread() isthreading.main_thread()):
stacklevel=2try:
f=sys._getframe(1)
exceptAttributeError:
passelse:
# Move up the call stack so that the warning is attached# to the line outside asyncio itself.whilef:
module=f.f_globals.get('__name__')
ifnot (module=='asyncio'ormodule.startswith('asyncio.')):
breakf=f.f_backstacklevel+=1importwarnings>warnings.warn('There is no current event loop',
DeprecationWarning, stacklevel=stacklevel)
EDeprecationWarning: Thereisnocurrenteventloop/usr/lib64/python3.12/asyncio/events.py:697: DeprecationWarning
(Above is a sample. The same happens for all tests from test_asyncio.py)
We've turned off that setting for now.
The text was updated successfully, but these errors were encountered:
We intend to update
pytest-asyncio
to the latest release (0.23.5.post1) in Fedora. Testing packages that depend on it, showedpytest-subprocess
tests failing, because warnings are turned into errors as per:pytest-subprocess/pytest.ini
Lines 3 to 5 in cc26247
resulting in:
(Above is a sample. The same happens for all tests from
test_asyncio.py
)We've turned off that setting for now.
The text was updated successfully, but these errors were encountered: