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
At first, since the error seemingly occured at the very end of the test suite, I suspected a broken interaction with a plugin, so I uninstalled a few of them (xdist, forked, profiling, cov, sugar), but it's still failing:
I've also tried to isolate a specific test that could cause this issue, by runnining only a subset of the tests, but I couldn't isolate one this way. However, I did find an interesting outcome! With the 110 tests uncommented, I get the core dumped issues. But when I commented tests one by one, at one point, I got a recursion error:
bash-4.4# pytest --reuse-db -p no:randomly tests/music/test_views.py
=========================================== test session starts ===========================================
platform linux -- Python 3.6.8, pytest-5.3.3, py-1.8.1, pluggy-0.13.1
Django settings: config.settings.local (from environment variable)
rootdir: /app, inifile: setup.cfg
plugins: env-0.6.2, requests-mock-1.7.0, mock-2.0.0, django-3.7.0, celery-4.3.0
collected 93 items
tests/music/test_views.py ......................................................................... [ 78%]
....................E [100%]
================================================= ERRORS ==================================================
_______ ERROR at teardown of test_detail_includes_description_key[api:v1:tracks-detail-music.Track] _______
cls = <class '_pytest.runner.CallInfo'>
func = <function call_runtest_hook.<locals>.<lambda> at 0x7ff6edcd9e18>, when = 'teardown'
reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)
@classmethod
def from_call(cls, func, when, reraise=None) -> "CallInfo":
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
start = time()
excinfo = None
try:
> result = func()
/usr/lib/python3.6/site-packages/_pytest/runner.py:235:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.6/site-packages/_pytest/runner.py:208: in <lambda>
lambda: ihook(item=item, **kwds), when=when, reraise=reraise
/usr/lib/python3.6/site-packages/pluggy/hooks.py:286: in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
/usr/lib/python3.6/site-packages/pluggy/manager.py:93: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/usr/lib/python3.6/site-packages/pluggy/manager.py:87: in <lambda>
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
/usr/lib/python3.6/site-packages/_pytest/runner.py:147: in pytest_runtest_teardown
item.session._setupstate.teardown_exact(item, nextitem)
/usr/lib/python3.6/site-packages/_pytest/runner.py:332: in teardown_exact
self._teardown_towards(needed_collectors)
/usr/lib/python3.6/site-packages/_pytest/runner.py:349: in _teardown_towards
raise val.with_traceback(tb)
/usr/lib/python3.6/site-packages/_pytest/runner.py:340: in _teardown_towards
self._pop_and_teardown()
/usr/lib/python3.6/site-packages/_pytest/runner.py:298: in _pop_and_teardown
self._teardown_with_finalization(colitem)
/usr/lib/python3.6/site-packages/_pytest/runner.py:318: in _teardown_with_finalization
self._callfinalizers(colitem)
/usr/lib/python3.6/site-packages/_pytest/runner.py:315: in _callfinalizers
raise val.with_traceback(tb)
/usr/lib/python3.6/site-packages/_pytest/runner.py:306: in _callfinalizers
fin()
/usr/lib/python3.6/site-packages/_pytest/fixtures.py:873: in finish
raise val.with_traceback(tb)
/usr/lib/python3.6/site-packages/_pytest/fixtures.py:866: in finish
func
###
# I TRUNCATED THE LOG, BUT THIS WAS REPEATED 100s OF TIMES
###
/usr/lib/python3.6/site-packages/_pytest/fixtures.py:873: in finish
raise val.with_traceback(tb)
/usr/lib/python3.6/site-packages/_pytest/fixtures.py:866: in finish
func()
/usr/lib/python3.6/site-packages/_pytest/fixtures.py:873: in finish
raise val.with_traceback(tb)
/usr/lib/python3.6/site-packages/_pytest/fixtures.py:866: in finish
func()
/usr/lib/python3.6/site-packages/_pytest/fixtures.py:876: in finish
hook.pytest_fixture_post_finalizer(fixturedef=self, request=request)
/usr/lib/python3.6/site-packages/pluggy/hooks.py:286: in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
/usr/lib/python3.6/site-packages/pluggy/manager.py:93: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hook = <_HookCaller 'pytest_fixture_post_finalizer'>
methods = [<HookImpl plugin_name='setuponly', plugin=<module '_pytest.setuponly' from '/usr/lib/python3.6/site-packages/_pytest/setuponly.py'>>]
kwargs = {'fixturedef': <FixtureDef argname='django_db_setup' scope='session' baseid=''>, 'request': <SubRequest 'django_db_setup' for <Function test_refresh_remote_entity_when_param_is_true[music.Artist-api:v1:artists-detail]>>}
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
methods,
kwargs,
> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
)
E RecursionError: maximum recursion depth exceeded while calling a Python object
/usr/lib/python3.6/site-packages/pluggy/manager.py:87: RecursionError
============================================ warnings summary =============================================
tests/music/test_views.py::test_can_get_libraries_for_music_entities[artist]
tests/music/test_views.py::test_refresh_remote_entity_when_param_is_true[music.Artist-api:v1:artists-detail]
tests/music/test_views.py::test_refresh_remote_entity_no_param[false]
tests/music/test_views.py::test_refresh_remote_entity_no_param[0]
tests/music/test_views.py::test_refresh_remote_entity_no_param[]
tests/music/test_views.py::test_artist_list_exclude_channels[params2-1]
tests/music/test_views.py::test_search_get[True]
tests/music/test_views.py::test_search_get[False]
tests/music/test_views.py::test_detail_includes_description_key[api:v1:artists-detail-music.Artist]
/usr/lib/python3.6/site-packages/django/db/models/query.py:1242: RemovedInDjango31Warning: Album QuerySet won't use Meta.ordering in Django 3.1. Add .order_by('-creation_date') to retain the current query.
self._result_cache = list(self._iterable_class(self))
tests/music/test_views.py::test_can_get_libraries_for_music_entities[artist]
tests/music/test_views.py::test_can_get_libraries_for_music_entities[album]
tests/music/test_views.py::test_can_get_libraries_for_music_entities[track]
/usr/lib/python3.6/site-packages/rest_framework/pagination.py:200: UnorderedObjectListWarning: Pagination may yield inconsistent results with an unordered object_list: <class 'funkwhale_api.music.models.Library'> LibraryQuerySet.
paginator = self.django_paginator_class(queryset, page_size)
-- Docs: https://docs.pytest.org/en/latest/warnings.html
================================ 93 passed, 12 warnings, 1 error in 31.26s ================================
I don't have the time to provide a minimal example right now, but I can definitely give more information or try some commands, since I reliably reproduce this in my dev environment, inside a Docker container running Linux Alpine and Python 3.6.8.
Thanks for the report! Seems to be the same issue as in #6492. The workaround for now is to pin pytest to 5.3.2 until we figure out if the problem is in pytest or pytest-django. 👍
Closing this one in favor of #6492, please subscribe to it to get notifications on the progress of this problem. 👍
@EliotBerriot
It might be useful to run it with -l to show locals in the traceback (to see what those finish calls are about), and/or put a pdb.set_trace()/print there to see if it is the same fixture all the time.
/cc @SalmonMode I think this might be interesting for debugging.
My test suite fails consistently at 99% (e.g https://dev.funkwhale.audio/funkwhale/funkwhale/-/jobs/40524) when using Pytest 5.3.3. The issue doesn't seem to occur when using Pytest 5.3.2, so I suspect it is a regression.
Fortunately, I seem to reproduce the issue when running only a fraction of my test suite, e.g:
At first, since the error seemingly occured at the very end of the test suite, I suspected a broken interaction with a plugin, so I uninstalled a few of them (xdist, forked, profiling, cov, sugar), but it's still failing:
I've also tried to isolate a specific test that could cause this issue, by runnining only a subset of the tests, but I couldn't isolate one this way. However, I did find an interesting outcome! With the 110 tests uncommented, I get the
core dumped
issues. But when I commented tests one by one, at one point, I got a recursion error:I don't have the time to provide a minimal example right now, but I can definitely give more information or try some commands, since I reliably reproduce this in my dev environment, inside a Docker container running Linux Alpine and Python 3.6.8.
pip freeze
output:By the way, many thanks to the Pytest community for the amazing piece of software ❤️ Let me know if I can provide anything else to troubleshoot this.
The text was updated successfully, but these errors were encountered: