* Package: dev-python/pytest-trio-0.7.0 * Repository: gentoo * Maintainer: andrewammerlaan@gentoo.org * USE: arm elibc_glibc kernel_linux python_targets_python3_8 python_targets_python3_9 test userland_GNU * FEATURES: network-sandbox preserve-libs sandbox test userpriv usersandbox >>> Unpacking source... >>> Unpacking pytest-trio-0.7.0.tar.gz to /var/tmp/portage/dev-python/pytest-trio-0.7.0/work >>> Source unpacked in /var/tmp/portage/dev-python/pytest-trio-0.7.0/work >>> Preparing source in /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0 ... >>> Source prepared. >>> Configuring source in /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0 ... >>> Source configured. >>> Compiling source in /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0 ... * python3_8: running distutils-r1_run_phase distutils-r1_python_compile python3.8 setup.py build -j 8 running build running build_py creating /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio copying pytest_trio/plugin.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio copying pytest_trio/enable_trio_mode.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio copying pytest_trio/_version.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio copying pytest_trio/__init__.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio creating /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests copying pytest_trio/_tests/test_clock_fixture.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests copying pytest_trio/_tests/test_basic.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests copying pytest_trio/_tests/test_contextvars.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests copying pytest_trio/_tests/test_sync_fixture.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests copying pytest_trio/_tests/__init__.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests copying pytest_trio/_tests/test_fixture_nursery.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests copying pytest_trio/_tests/test_fixture_ordering.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests copying pytest_trio/_tests/test_fixture_names.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests copying pytest_trio/_tests/test_hypothesis_interaction.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests copying pytest_trio/_tests/test_trio_mode.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests copying pytest_trio/_tests/test_fixture_mistakes.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests copying pytest_trio/_tests/test_async_fixture.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests copying pytest_trio/_tests/helpers.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests copying pytest_trio/_tests/test_async_yield_fixture.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests warning: build_py: byte-compiling is disabled, skipping. * python3_9: running distutils-r1_run_phase distutils-r1_python_compile python3.9 setup.py build -j 8 running build running build_py creating /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_9/lib/pytest_trio copying pytest_trio/plugin.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_9/lib/pytest_trio copying pytest_trio/enable_trio_mode.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_9/lib/pytest_trio copying pytest_trio/_version.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_9/lib/pytest_trio copying pytest_trio/__init__.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_9/lib/pytest_trio creating /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_9/lib/pytest_trio/_tests copying pytest_trio/_tests/test_clock_fixture.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_9/lib/pytest_trio/_tests copying pytest_trio/_tests/test_basic.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_9/lib/pytest_trio/_tests copying pytest_trio/_tests/test_contextvars.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_9/lib/pytest_trio/_tests copying pytest_trio/_tests/test_sync_fixture.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_9/lib/pytest_trio/_tests copying pytest_trio/_tests/__init__.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_9/lib/pytest_trio/_tests copying pytest_trio/_tests/test_fixture_nursery.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_9/lib/pytest_trio/_tests copying pytest_trio/_tests/test_fixture_ordering.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_9/lib/pytest_trio/_tests copying pytest_trio/_tests/test_fixture_names.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_9/lib/pytest_trio/_tests copying pytest_trio/_tests/test_hypothesis_interaction.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_9/lib/pytest_trio/_tests copying pytest_trio/_tests/test_trio_mode.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_9/lib/pytest_trio/_tests copying pytest_trio/_tests/test_fixture_mistakes.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_9/lib/pytest_trio/_tests copying pytest_trio/_tests/test_async_fixture.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_9/lib/pytest_trio/_tests copying pytest_trio/_tests/helpers.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_9/lib/pytest_trio/_tests copying pytest_trio/_tests/test_async_yield_fixture.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_9/lib/pytest_trio/_tests warning: build_py: byte-compiling is disabled, skipping. * Using python3.9 in global scope * python3_9: running distutils-r1_run_phase python_compile_all >>> Source compiled. >>> Test phase: dev-python/pytest-trio-0.7.0 * python3_8: running distutils-r1_run_phase python_test python3.8 setup.py install --root=/var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/test --install-lib=lib --install-scripts=scripts running install running build running build_py warning: build_py: byte-compiling is disabled, skipping. running install_lib creating /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/test creating /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/test/lib creating /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/test/lib/pytest_trio creating /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/test/lib/pytest_trio/_tests copying /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests/test_fixture_ordering.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/test/lib/pytest_trio/_tests copying /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests/test_sync_fixture.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/test/lib/pytest_trio/_tests copying /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests/helpers.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/test/lib/pytest_trio/_tests copying /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests/test_fixture_names.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/test/lib/pytest_trio/_tests copying /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests/test_fixture_nursery.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/test/lib/pytest_trio/_tests copying /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests/test_async_yield_fixture.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/test/lib/pytest_trio/_tests copying /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests/test_async_fixture.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/test/lib/pytest_trio/_tests copying /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests/test_trio_mode.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/test/lib/pytest_trio/_tests copying /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests/test_basic.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/test/lib/pytest_trio/_tests copying /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests/test_hypothesis_interaction.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/test/lib/pytest_trio/_tests copying /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests/__init__.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/test/lib/pytest_trio/_tests copying /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests/test_clock_fixture.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/test/lib/pytest_trio/_tests copying /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests/test_fixture_mistakes.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/test/lib/pytest_trio/_tests copying /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_tests/test_contextvars.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/test/lib/pytest_trio/_tests copying /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/enable_trio_mode.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/test/lib/pytest_trio copying /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/plugin.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/test/lib/pytest_trio copying /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/_version.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/test/lib/pytest_trio copying /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/lib/pytest_trio/__init__.py -> /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/test/lib/pytest_trio warning: install_lib: byte-compiling is disabled, skipping. running install_egg_info running egg_info writing pytest_trio.egg-info/PKG-INFO writing dependency_links to pytest_trio.egg-info/dependency_links.txt writing entry points to pytest_trio.egg-info/entry_points.txt writing requirements to pytest_trio.egg-info/requires.txt writing top-level names to pytest_trio.egg-info/top_level.txt reading manifest file 'pytest_trio.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' no previously-included directories found matching 'docs/build' adding license file 'LICENSE' adding license file 'LICENSE.APACHE2' adding license file 'LICENSE.MIT' writing manifest file 'pytest_trio.egg-info/SOURCES.txt' Copying pytest_trio.egg-info to /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0-python3_8/test/lib/pytest_trio-0.7.0-py3.8.egg-info running install_scripts python3.8 -m pytest -vv -ra -l -Wdefault ==================================================================== test session starts ===================================================================== platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- /usr/bin/python3.8 cachedir: .pytest_cache hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0/.hypothesis/examples') rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0 plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1 collecting ... collected 66 items pytest_trio/_tests/test_async_fixture.py::test_single_async_fixture FAILED [ 1%] pytest_trio/_tests/test_async_fixture.py::test_async_fixture_recomputed_for_each_test FAILED [ 3%] pytest_trio/_tests/test_async_fixture.py::test_nested_async_fixture FAILED [ 4%] pytest_trio/_tests/test_async_fixture.py::test_async_within_sync_fixture FAILED [ 6%] pytest_trio/_tests/test_async_fixture.py::test_raise_in_async_fixture_cause_pytest_error XPASS (Not implemented yet) [ 7%] pytest_trio/_tests/test_async_yield_fixture.py::test_single_async_yield_fixture[Python>=36] FAILED [ 9%] pytest_trio/_tests/test_async_yield_fixture.py::test_single_async_yield_fixture[async_generator] PASSED [ 10%] pytest_trio/_tests/test_async_yield_fixture.py::test_nested_async_yield_fixture[Python>=36] FAILED [ 12%] pytest_trio/_tests/test_async_yield_fixture.py::test_nested_async_yield_fixture[async_generator] PASSED [ 13%] pytest_trio/_tests/test_async_yield_fixture.py::test_async_yield_fixture_within_sync_fixture[Python>=36] FAILED [ 15%] pytest_trio/_tests/test_async_yield_fixture.py::test_async_yield_fixture_within_sync_fixture[async_generator] PASSED [ 16%] pytest_trio/_tests/test_async_yield_fixture.py::test_async_yield_fixture_within_sync_yield_fixture[Python>=36] FAILED [ 18%] pytest_trio/_tests/test_async_yield_fixture.py::test_async_yield_fixture_within_sync_yield_fixture[async_generator] PASSED [ 19%] pytest_trio/_tests/test_async_yield_fixture.py::test_async_yield_fixture_with_multiple_yields[Python>=36] FAILED [ 21%] pytest_trio/_tests/test_async_yield_fixture.py::test_async_yield_fixture_with_multiple_yields[async_generator] PASSED [ 22%] pytest_trio/_tests/test_async_yield_fixture.py::test_async_yield_fixture_with_nursery[Python>=36] FAILED [ 24%] pytest_trio/_tests/test_async_yield_fixture.py::test_async_yield_fixture_with_nursery[async_generator] PASSED [ 25%] pytest_trio/_tests/test_async_yield_fixture.py::test_async_yield_fixture_crashed_teardown_allow_other_teardowns[Python>=36] FAILED [ 27%] pytest_trio/_tests/test_async_yield_fixture.py::test_async_yield_fixture_crashed_teardown_allow_other_teardowns[async_generator] PASSED [ 28%] pytest_trio/_tests/test_basic.py::test_async_test_is_executed PASSED [ 30%] pytest_trio/_tests/test_basic.py::test_async_test_as_class_method FAILED [ 31%] pytest_trio/_tests/test_basic.py::test_sync_function_with_trio_mark XFAIL (Raises pytest internal error so far...) [ 33%] pytest_trio/_tests/test_clock_fixture.py::test_sleep_with_autojump_clock PASSED [ 34%] pytest_trio/_tests/test_contextvars.py::test_contextvars PASSED [ 36%] pytest_trio/_tests/test_fixture_mistakes.py::test_trio_fixture_with_non_trio_test PASSED [ 37%] pytest_trio/_tests/test_fixture_mistakes.py::test_trio_fixture_with_wrong_scope_without_trio_mode FAILED [ 39%] pytest_trio/_tests/test_fixture_mistakes.py::test_trio_fixture_with_wrong_scope_in_trio_mode[enable_trio_mode_via_pytest_ini] FAILED [ 40%] pytest_trio/_tests/test_fixture_mistakes.py::test_trio_fixture_with_wrong_scope_in_trio_mode[enable_trio_mode_trio_run_via_pytest_ini] FAILED [ 42%] pytest_trio/_tests/test_fixture_mistakes.py::test_trio_fixture_with_wrong_scope_in_trio_mode[enable_trio_mode_via_conftest_py] FAILED [ 43%] pytest_trio/_tests/test_fixture_mistakes.py::test_async_fixture_with_sync_test_in_trio_mode[enable_trio_mode_via_pytest_ini] FAILED [ 45%] pytest_trio/_tests/test_fixture_mistakes.py::test_async_fixture_with_sync_test_in_trio_mode[enable_trio_mode_trio_run_via_pytest_ini] FAILED [ 46%] pytest_trio/_tests/test_fixture_mistakes.py::test_async_fixture_with_sync_test_in_trio_mode[enable_trio_mode_via_conftest_py] FAILED [ 48%] pytest_trio/_tests/test_fixture_mistakes.py::test_fixture_cancels_test_but_doesnt_raise[enable_trio_mode_via_pytest_ini] PASSED [ 50%] pytest_trio/_tests/test_fixture_mistakes.py::test_fixture_cancels_test_but_doesnt_raise[enable_trio_mode_trio_run_via_pytest_ini] PASSED [ 51%] pytest_trio/_tests/test_fixture_mistakes.py::test_fixture_cancels_test_but_doesnt_raise[enable_trio_mode_via_conftest_py] PASSED [ 53%] pytest_trio/_tests/test_fixture_mistakes.py::test_too_many_clocks[enable_trio_mode_via_pytest_ini] PASSED [ 54%] pytest_trio/_tests/test_fixture_mistakes.py::test_too_many_clocks[enable_trio_mode_trio_run_via_pytest_ini] PASSED [ 56%] pytest_trio/_tests/test_fixture_mistakes.py::test_too_many_clocks[enable_trio_mode_via_conftest_py] PASSED [ 57%] pytest_trio/_tests/test_fixture_names.py::test_fixture_names PASSED [ 59%] pytest_trio/_tests/test_fixture_nursery.py::test_try FAILED [ 60%] pytest_trio/_tests/test_fixture_ordering.py::test_fixture_basic_ordering PASSED [ 62%] pytest_trio/_tests/test_fixture_ordering.py::test_nursery_fixture_teardown_ordering PASSED [ 63%] pytest_trio/_tests/test_fixture_ordering.py::test_error_collection FAILED [ 65%] pytest_trio/_tests/test_fixture_ordering.py::test_background_crash_cancellation_propagation[nursery fixture] PASSED [ 66%] pytest_trio/_tests/test_fixture_ordering.py::test_background_crash_cancellation_propagation[manual nursery] PASSED [ 68%] pytest_trio/_tests/test_fixture_ordering.py::test_complex_cancel_interaction_regression PASSED [ 69%] pytest_trio/_tests/test_hypothesis_interaction.py::test_the_trio_scheduler_is_not_deterministic <- ../../../../../../../usr/lib/python3.8/site-packages/trio/tests/test_scheduler_determinism.py PASSED [ 71%] pytest_trio/_tests/test_hypothesis_interaction.py::test_the_trio_scheduler_is_deterministic_if_seeded <- ../../../../../../../usr/lib/python3.8/site-packages/trio/tests/test_scheduler_determinism.py PASSED [ 72%] pytest_trio/_tests/test_hypothesis_interaction.py::test_mark_inner PASSED [ 74%] pytest_trio/_tests/test_hypothesis_interaction.py::test_mark_outer PASSED [ 75%] pytest_trio/_tests/test_hypothesis_interaction.py::test_mark_and_parametrize[1] PASSED [ 77%] pytest_trio/_tests/test_hypothesis_interaction.py::test_mark_and_parametrize[2] PASSED [ 78%] pytest_trio/_tests/test_hypothesis_interaction.py::test_the_trio_scheduler_is_deterministic_under_hypothesis PASSED [ 80%] pytest_trio/_tests/test_sync_fixture.py::test_single_sync_fixture PASSED [ 81%] pytest_trio/_tests/test_sync_fixture.py::test_single_yield_fixture PASSED [ 83%] pytest_trio/_tests/test_sync_fixture.py::test_single_yield_fixture_with_async_deps FAILED [ 84%] pytest_trio/_tests/test_sync_fixture.py::test_sync_yield_fixture_crashed_teardown_allow_other_teardowns FAILED [ 86%] pytest_trio/_tests/test_trio_mode.py::test_trio_mode[enable_trio_mode_via_pytest_ini] PASSED [ 87%] pytest_trio/_tests/test_trio_mode.py::test_trio_mode[enable_trio_mode_trio_run_via_pytest_ini] PASSED [ 89%] pytest_trio/_tests/test_trio_mode.py::test_trio_mode[enable_trio_mode_via_conftest_py] PASSED [ 90%] pytest_trio/_tests/test_trio_mode.py::test_trio_mode_and_qtrio_run_configuration PASSED [ 92%] pytest_trio/_tests/test_trio_mode.py::test_trio_mode_and_qtrio_marker PASSED [ 93%] pytest_trio/_tests/test_trio_mode.py::test_qtrio_just_run_configuration PASSED [ 95%] pytest_trio/_tests/test_trio_mode.py::test_invalid_trio_run_fails PASSED [ 96%] pytest_trio/_tests/test_trio_mode.py::test_closest_explicit_run_wins PASSED [ 98%] pytest_trio/_tests/test_trio_mode.py::test_ini_run_wins_with_blank_marker PASSED [100%] ========================================================================== FAILURES ========================================================================== _________________________________________________________________ test_single_async_fixture __________________________________________________________________ testdir = def test_single_async_fixture(testdir): testdir.makepyfile( """ import pytest import trio @pytest.fixture async def fix1(): await trio.sleep(0) return 'fix1' @pytest.mark.trio async def test_simple(fix1): assert fix1 == 'fix1' """ ) result = testdir.runpytest() > result.assert_outcomes(passed=1) E AssertionError: assert {'errors': 1,\n 'failed': 0,\n 'passed': 0,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} == {'errors': 0,\n 'failed': 0,\n 'passed': 1,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} E Common items: E {'failed': 0, 'skipped': 0, 'xfailed': 0, 'xpassed': 0} E Differing items: E {'errors': 1} != {'errors': 0} E {'passed': 0} != {'passed': 1} E Full diff: E { E - 'errors': 0, E ? ^ E + 'errors': 1, E ? ^ E 'failed': 0, E - 'passed': 1, E ? ^ E + 'passed': 0, E ? ^ E 'skipped': 0, E 'xfailed': 0, E 'xpassed': 0, E } result = testdir = /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0/pytest_trio/_tests/test_async_fixture.py:24: AssertionError -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- ==================================================================== test session starts ===================================================================== platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/pytest-of-portage/pytest-0/test_single_async_fixture0 plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1 collected 1 item test_single_async_fixture.py E [100%] =========================================================================== ERRORS =========================================================================== _______________________________________________________________ ERROR at setup of test_simple ________________________________________________________________ @pytest.fixture async def fix1(): > await trio.sleep(0) test_single_async_fixture.py:6: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/trio/_timeouts.py:74: in sleep await trio.lowlevel.checkpoint() /usr/lib/python3.8/site-packages/trio/_core/_run.py:2332: in checkpoint await cancel_shielded_checkpoint() /usr/lib/python3.8/site-packages/trio/_core/_traps.py:43: in cancel_shielded_checkpoint return (await _async_yield(CancelShieldedCheckpoint)).unwrap() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ obj = @types.coroutine def _async_yield(obj): > return (yield obj) E RuntimeError: Task got bad yield: /usr/lib/python3.8/site-packages/trio/_core/_traps.py:21: RuntimeError ================================================================== short test summary info =================================================================== ERROR test_single_async_fixture.py::test_simple - RuntimeError: Task got bad yield: ====================================================================== 1 error in 0.42s ====================================================================== ________________________________________________________ test_async_fixture_recomputed_for_each_test _________________________________________________________ testdir = def test_async_fixture_recomputed_for_each_test(testdir): testdir.makepyfile( """ import pytest import trio counter = 0 @pytest.fixture async def fix1(): global counter await trio.sleep(0) counter += 1 return counter @pytest.mark.trio async def test_first(fix1): assert fix1 == 1 @pytest.mark.trio async def test_second(fix1): assert fix1 == 2 """ ) result = testdir.runpytest() > result.assert_outcomes(passed=2) E AssertionError: assert {'errors': 2,\n 'failed': 0,\n 'passed': 0,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} == {'errors': 0,\n 'failed': 0,\n 'passed': 2,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} E Common items: E {'failed': 0, 'skipped': 0, 'xfailed': 0, 'xpassed': 0} E Differing items: E {'errors': 2} != {'errors': 0} E {'passed': 0} != {'passed': 2} E Full diff: E { E - 'errors': 0, E ? ^ E + 'errors': 2, E ? ^ E 'failed': 0, E - 'passed': 2, E ? ^ E + 'passed': 0, E ? ^ E 'skipped': 0, E 'xfailed': 0, E 'xpassed': 0, E } result = testdir = /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0/pytest_trio/_tests/test_async_fixture.py:55: AssertionError -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- ==================================================================== test session starts ===================================================================== platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/pytest-of-portage/pytest-0/test_async_fixture_recomputed_for_each_test0 plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1 collected 2 items test_async_fixture_recomputed_for_each_test.py EE [100%] =========================================================================== ERRORS =========================================================================== ________________________________________________________________ ERROR at setup of test_first ________________________________________________________________ @pytest.fixture async def fix1(): global counter > await trio.sleep(0) test_async_fixture_recomputed_for_each_test.py:9: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/trio/_timeouts.py:74: in sleep await trio.lowlevel.checkpoint() /usr/lib/python3.8/site-packages/trio/_core/_run.py:2332: in checkpoint await cancel_shielded_checkpoint() /usr/lib/python3.8/site-packages/trio/_core/_traps.py:43: in cancel_shielded_checkpoint return (await _async_yield(CancelShieldedCheckpoint)).unwrap() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ obj = @types.coroutine def _async_yield(obj): > return (yield obj) E RuntimeError: Task got bad yield: /usr/lib/python3.8/site-packages/trio/_core/_traps.py:21: RuntimeError _______________________________________________________________ ERROR at setup of test_second ________________________________________________________________ @pytest.fixture async def fix1(): global counter > await trio.sleep(0) test_async_fixture_recomputed_for_each_test.py:9: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/trio/_timeouts.py:74: in sleep await trio.lowlevel.checkpoint() /usr/lib/python3.8/site-packages/trio/_core/_run.py:2332: in checkpoint await cancel_shielded_checkpoint() /usr/lib/python3.8/site-packages/trio/_core/_traps.py:43: in cancel_shielded_checkpoint return (await _async_yield(CancelShieldedCheckpoint)).unwrap() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ obj = @types.coroutine def _async_yield(obj): > return (yield obj) E RuntimeError: Task got bad yield: /usr/lib/python3.8/site-packages/trio/_core/_traps.py:21: RuntimeError ================================================================== short test summary info =================================================================== ERROR test_async_fixture_recomputed_for_each_test.py::test_first - RuntimeError: Task got bad yield: ERROR test_async_fixture_recomputed_for_each_test.py::test_second - RuntimeError: Task got bad yield: ===================================================================== 2 errors in 0.35s ====================================================================== _________________________________________________________________ test_nested_async_fixture __________________________________________________________________ testdir = def test_nested_async_fixture(testdir): testdir.makepyfile( """ import pytest import trio @pytest.fixture async def fix1(): await trio.sleep(0) return 'fix1' @pytest.fixture async def fix2(fix1): await trio.sleep(0) return 'fix2(%s)' % fix1 @pytest.mark.trio async def test_simple(fix2): assert fix2 == 'fix2(fix1)' @pytest.mark.trio async def test_both(fix1, fix2): assert fix1 == 'fix1' assert fix2 == 'fix2(fix1)' """ ) result = testdir.runpytest() > result.assert_outcomes(passed=2) E AssertionError: assert {'errors': 2,\n 'failed': 0,\n 'passed': 0,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} == {'errors': 0,\n 'failed': 0,\n 'passed': 2,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} E Common items: E {'failed': 0, 'skipped': 0, 'xfailed': 0, 'xpassed': 0} E Differing items: E {'errors': 2} != {'errors': 0} E {'passed': 0} != {'passed': 2} E Full diff: E { E - 'errors': 0, E ? ^ E + 'errors': 2, E ? ^ E 'failed': 0, E - 'passed': 2, E ? ^ E + 'passed': 0, E ? ^ E 'skipped': 0, E 'xfailed': 0, E 'xpassed': 0, E } result = testdir = /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0/pytest_trio/_tests/test_async_fixture.py:88: AssertionError -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- ==================================================================== test session starts ===================================================================== platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/pytest-of-portage/pytest-0/test_nested_async_fixture0 plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1 collected 2 items test_nested_async_fixture.py EE [100%] =========================================================================== ERRORS =========================================================================== _______________________________________________________________ ERROR at setup of test_simple ________________________________________________________________ @pytest.fixture async def fix1(): > await trio.sleep(0) test_nested_async_fixture.py:6: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/trio/_timeouts.py:74: in sleep await trio.lowlevel.checkpoint() /usr/lib/python3.8/site-packages/trio/_core/_run.py:2332: in checkpoint await cancel_shielded_checkpoint() /usr/lib/python3.8/site-packages/trio/_core/_traps.py:43: in cancel_shielded_checkpoint return (await _async_yield(CancelShieldedCheckpoint)).unwrap() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ obj = @types.coroutine def _async_yield(obj): > return (yield obj) E RuntimeError: Task got bad yield: /usr/lib/python3.8/site-packages/trio/_core/_traps.py:21: RuntimeError ________________________________________________________________ ERROR at setup of test_both _________________________________________________________________ @pytest.fixture async def fix1(): > await trio.sleep(0) test_nested_async_fixture.py:6: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/trio/_timeouts.py:74: in sleep await trio.lowlevel.checkpoint() /usr/lib/python3.8/site-packages/trio/_core/_run.py:2332: in checkpoint await cancel_shielded_checkpoint() /usr/lib/python3.8/site-packages/trio/_core/_traps.py:43: in cancel_shielded_checkpoint return (await _async_yield(CancelShieldedCheckpoint)).unwrap() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ obj = @types.coroutine def _async_yield(obj): > return (yield obj) E RuntimeError: Task got bad yield: /usr/lib/python3.8/site-packages/trio/_core/_traps.py:21: RuntimeError ================================================================== short test summary info =================================================================== ERROR test_nested_async_fixture.py::test_simple - RuntimeError: Task got bad yield: ERROR test_nested_async_fixture.py::test_both - RuntimeError: Task got bad yield: ===================================================================== 2 errors in 0.32s ====================================================================== _______________________________________________________________ test_async_within_sync_fixture _______________________________________________________________ testdir = def test_async_within_sync_fixture(testdir): testdir.makepyfile( """ import pytest import trio @pytest.fixture async def async_fix(): await trio.sleep(0) return 42 @pytest.fixture def sync_fix(async_fix): return async_fix @pytest.mark.trio async def test_simple(sync_fix): assert sync_fix == 42 """ ) result = testdir.runpytest() > result.assert_outcomes(passed=1) E AssertionError: assert {'errors': 1,\n 'failed': 0,\n 'passed': 0,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} == {'errors': 0,\n 'failed': 0,\n 'passed': 1,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} E Common items: E {'failed': 0, 'skipped': 0, 'xfailed': 0, 'xpassed': 0} E Differing items: E {'errors': 1} != {'errors': 0} E {'passed': 0} != {'passed': 1} E Full diff: E { E - 'errors': 0, E ? ^ E + 'errors': 1, E ? ^ E 'failed': 0, E - 'passed': 1, E ? ^ E + 'passed': 0, E ? ^ E 'skipped': 0, E 'xfailed': 0, E 'xpassed': 0, E } result = testdir = /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0/pytest_trio/_tests/test_async_fixture.py:115: AssertionError -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- ==================================================================== test session starts ===================================================================== platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/pytest-of-portage/pytest-0/test_async_within_sync_fixture0 plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1 collected 1 item test_async_within_sync_fixture.py E [100%] =========================================================================== ERRORS =========================================================================== _______________________________________________________________ ERROR at setup of test_simple ________________________________________________________________ @pytest.fixture async def async_fix(): > await trio.sleep(0) test_async_within_sync_fixture.py:6: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/trio/_timeouts.py:74: in sleep await trio.lowlevel.checkpoint() /usr/lib/python3.8/site-packages/trio/_core/_run.py:2332: in checkpoint await cancel_shielded_checkpoint() /usr/lib/python3.8/site-packages/trio/_core/_traps.py:43: in cancel_shielded_checkpoint return (await _async_yield(CancelShieldedCheckpoint)).unwrap() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ obj = @types.coroutine def _async_yield(obj): > return (yield obj) E RuntimeError: Task got bad yield: /usr/lib/python3.8/site-packages/trio/_core/_traps.py:21: RuntimeError ================================================================== short test summary info =================================================================== ERROR test_async_within_sync_fixture.py::test_simple - RuntimeError: Task got bad yield: ====================================================================== 1 error in 0.20s ====================================================================== ________________________________________________________ test_single_async_yield_fixture[Python>=36] _________________________________________________________ testdir = async_yield_implementation = .patch_code at 0xf4f81850> def test_single_async_yield_fixture(testdir, async_yield_implementation): testdir.makepyfile( async_yield_implementation( """ import pytest import trio from async_generator import async_generator, yield_ events = [] @pytest.fixture @async_generator async def fix1(): events.append('fix1 setup') await trio.sleep(0) await yield_('fix1') await trio.sleep(0) events.append('fix1 teardown') def test_before(): assert not events @pytest.mark.trio async def test_actual_test(fix1): assert events == ['fix1 setup'] assert fix1 == 'fix1' def test_after(): assert events == [ 'fix1 setup', 'fix1 teardown', ] """ ) ) result = testdir.runpytest() > result.assert_outcomes(passed=3) E AssertionError: assert {'errors': 1,\n 'failed': 1,\n 'passed': 1,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} == {'errors': 0,\n 'failed': 0,\n 'passed': 3,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} E Common items: E {'skipped': 0, 'xfailed': 0, 'xpassed': 0} E Differing items: E {'errors': 1} != {'errors': 0} E {'passed': 1} != {'passed': 3} E {'failed': 1} != {'failed': 0} E Full diff: E { E - 'errors': 0, E ? ^ E + 'errors': 1, E ? ^ E - 'failed': 0, E ? ^ E + 'failed': 1, E ? ^ E - 'passed': 3, E ? ^ E + 'passed': 1, E ? ^ E 'skipped': 0, E 'xfailed': 0, E 'xpassed': 0, E } async_yield_implementation = .patch_code at 0xf4f81850> result = testdir = /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0/pytest_trio/_tests/test_async_yield_fixture.py:61: AssertionError -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- ==================================================================== test session starts ===================================================================== platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/pytest-of-portage/pytest-0/test_single_async_yield_fixture0 plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1 collected 3 items test_single_async_yield_fixture.py .EF [100%] =========================================================================== ERRORS =========================================================================== _____________________________________________________________ ERROR at setup of test_actual_test _____________________________________________________________ @pytest.fixture async def fix1(): events.append('fix1 setup') > await trio.sleep(0) test_single_async_yield_fixture.py:10: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/trio/_timeouts.py:74: in sleep await trio.lowlevel.checkpoint() /usr/lib/python3.8/site-packages/trio/_core/_run.py:2332: in checkpoint await cancel_shielded_checkpoint() /usr/lib/python3.8/site-packages/trio/_core/_traps.py:43: in cancel_shielded_checkpoint return (await _async_yield(CancelShieldedCheckpoint)).unwrap() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ obj = @types.coroutine def _async_yield(obj): > return (yield obj) E RuntimeError: Task got bad yield: /usr/lib/python3.8/site-packages/trio/_core/_traps.py:21: RuntimeError ========================================================================== FAILURES ========================================================================== _________________________________________________________________________ test_after _________________________________________________________________________ def test_after(): > assert events == [ 'fix1 setup', 'fix1 teardown', ] E AssertionError: assert ['fix1 setup'] == ['fix1 setup'...ix1 teardown'] E Right contains one more item: 'fix1 teardown' E Use -v to get the full diff test_single_async_yield_fixture.py:26: AssertionError ================================================================== short test summary info =================================================================== FAILED test_single_async_yield_fixture.py::test_after - AssertionError: assert ['fix1 setup'] == ['fix1 setup'...ix1 teardown'] ERROR test_single_async_yield_fixture.py::test_actual_test - RuntimeError: Task got bad yield: ============================================================ 1 failed, 1 passed, 1 error in 0.23s ============================================================ ________________________________________________________ test_nested_async_yield_fixture[Python>=36] _________________________________________________________ testdir = async_yield_implementation = .patch_code at 0xf4f2f070> def test_nested_async_yield_fixture(testdir, async_yield_implementation): testdir.makepyfile( async_yield_implementation( """ import pytest import trio from async_generator import async_generator, yield_ events = [] @pytest.fixture @async_generator async def fix2(): events.append('fix2 setup') await trio.sleep(0) await yield_('fix2') await trio.sleep(0) events.append('fix2 teardown') @pytest.fixture @async_generator async def fix1(fix2): events.append('fix1 setup') await trio.sleep(0) await yield_('fix1') await trio.sleep(0) events.append('fix1 teardown') def test_before(): assert not events @pytest.mark.trio async def test_actual_test(fix1): assert events == [ 'fix2 setup', 'fix1 setup', ] assert fix1 == 'fix1' def test_after(): assert events == [ 'fix2 setup', 'fix1 setup', 'fix1 teardown', 'fix2 teardown', ] """ ) ) result = testdir.runpytest() > result.assert_outcomes(passed=3) E AssertionError: assert {'errors': 1,\n 'failed': 1,\n 'passed': 1,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} == {'errors': 0,\n 'failed': 0,\n 'passed': 3,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} E Common items: E {'skipped': 0, 'xfailed': 0, 'xpassed': 0} E Differing items: E {'errors': 1} != {'errors': 0} E {'passed': 1} != {'passed': 3} E {'failed': 1} != {'failed': 0} E Full diff: E { E - 'errors': 0, E ? ^ E + 'errors': 1, E ? ^ E - 'failed': 0, E ? ^ E + 'failed': 1, E ? ^ E - 'passed': 3, E ? ^ E + 'passed': 1, E ? ^ E 'skipped': 0, E 'xfailed': 0, E 'xpassed': 0, E } async_yield_implementation = .patch_code at 0xf4f2f070> result = testdir = /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0/pytest_trio/_tests/test_async_yield_fixture.py:121: AssertionError -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- ==================================================================== test session starts ===================================================================== platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/pytest-of-portage/pytest-0/test_nested_async_yield_fixture0 plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1 collected 3 items test_nested_async_yield_fixture.py .EF [100%] =========================================================================== ERRORS =========================================================================== _____________________________________________________________ ERROR at setup of test_actual_test _____________________________________________________________ @pytest.fixture async def fix2(): events.append('fix2 setup') > await trio.sleep(0) test_nested_async_yield_fixture.py:10: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/trio/_timeouts.py:74: in sleep await trio.lowlevel.checkpoint() /usr/lib/python3.8/site-packages/trio/_core/_run.py:2332: in checkpoint await cancel_shielded_checkpoint() /usr/lib/python3.8/site-packages/trio/_core/_traps.py:43: in cancel_shielded_checkpoint return (await _async_yield(CancelShieldedCheckpoint)).unwrap() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ obj = @types.coroutine def _async_yield(obj): > return (yield obj) E RuntimeError: Task got bad yield: /usr/lib/python3.8/site-packages/trio/_core/_traps.py:21: RuntimeError ========================================================================== FAILURES ========================================================================== _________________________________________________________________________ test_after _________________________________________________________________________ def test_after(): > assert events == [ 'fix2 setup', 'fix1 setup', 'fix1 teardown', 'fix2 teardown', ] E AssertionError: assert ['fix2 setup'] == ['fix2 setup'...ix2 teardown'] E Right contains 3 more items, first extra item: 'fix1 setup' E Use -v to get the full diff test_nested_async_yield_fixture.py:39: AssertionError ================================================================== short test summary info =================================================================== FAILED test_nested_async_yield_fixture.py::test_after - AssertionError: assert ['fix2 setup'] == ['fix2 setup'...ix2 teardown'] ERROR test_nested_async_yield_fixture.py::test_actual_test - RuntimeError: Task got bad yield: ============================================================ 1 failed, 1 passed, 1 error in 0.33s ============================================================ __________________________________________________ test_async_yield_fixture_within_sync_fixture[Python>=36] __________________________________________________ testdir = async_yield_implementation = .patch_code at 0xf4dae4a8> def test_async_yield_fixture_within_sync_fixture( testdir, async_yield_implementation ): testdir.makepyfile( async_yield_implementation( """ import pytest import trio from async_generator import async_generator, yield_ events = [] @pytest.fixture @async_generator async def fix2(): events.append('fix2 setup') await trio.sleep(0) await yield_('fix2') await trio.sleep(0) events.append('fix2 teardown') @pytest.fixture def fix1(fix2): return 'fix1' def test_before(): assert not events @pytest.mark.trio async def test_actual_test(fix1): assert events == [ 'fix2 setup', ] assert fix1 == 'fix1' def test_after(): assert events == [ 'fix2 setup', 'fix2 teardown', ] """ ) ) result = testdir.runpytest() > result.assert_outcomes(passed=3) E AssertionError: assert {'errors': 1,\n 'failed': 1,\n 'passed': 1,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} == {'errors': 0,\n 'failed': 0,\n 'passed': 3,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} E Common items: E {'skipped': 0, 'xfailed': 0, 'xpassed': 0} E Differing items: E {'errors': 1} != {'errors': 0} E {'passed': 1} != {'passed': 3} E {'failed': 1} != {'failed': 0} E Full diff: E { E - 'errors': 0, E ? ^ E + 'errors': 1, E ? ^ E - 'failed': 0, E ? ^ E + 'failed': 1, E ? ^ E - 'passed': 3, E ? ^ E + 'passed': 1, E ? ^ E 'skipped': 0, E 'xfailed': 0, E 'xpassed': 0, E } async_yield_implementation = .patch_code at 0xf4dae4a8> result = testdir = /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0/pytest_trio/_tests/test_async_yield_fixture.py:173: AssertionError -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- ==================================================================== test session starts ===================================================================== platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/pytest-of-portage/pytest-0/test_async_yield_fixture_within_sync_fixture0 plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1 collected 3 items test_async_yield_fixture_within_sync_fixture.py .EF [100%] =========================================================================== ERRORS =========================================================================== _____________________________________________________________ ERROR at setup of test_actual_test _____________________________________________________________ @pytest.fixture async def fix2(): events.append('fix2 setup') > await trio.sleep(0) test_async_yield_fixture_within_sync_fixture.py:10: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/trio/_timeouts.py:74: in sleep await trio.lowlevel.checkpoint() /usr/lib/python3.8/site-packages/trio/_core/_run.py:2332: in checkpoint await cancel_shielded_checkpoint() /usr/lib/python3.8/site-packages/trio/_core/_traps.py:43: in cancel_shielded_checkpoint return (await _async_yield(CancelShieldedCheckpoint)).unwrap() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ obj = @types.coroutine def _async_yield(obj): > return (yield obj) E RuntimeError: Task got bad yield: /usr/lib/python3.8/site-packages/trio/_core/_traps.py:21: RuntimeError ========================================================================== FAILURES ========================================================================== _________________________________________________________________________ test_after _________________________________________________________________________ def test_after(): > assert events == [ 'fix2 setup', 'fix2 teardown', ] E AssertionError: assert ['fix2 setup'] == ['fix2 setup'...ix2 teardown'] E Right contains one more item: 'fix2 teardown' E Use -v to get the full diff test_async_yield_fixture_within_sync_fixture.py:32: AssertionError ================================================================== short test summary info =================================================================== FAILED test_async_yield_fixture_within_sync_fixture.py::test_after - AssertionError: assert ['fix2 setup'] == ['fix2 setup'...ix2 teardown'] ERROR test_async_yield_fixture_within_sync_fixture.py::test_actual_test - RuntimeError: Task got bad yield: =36] _______________________________________________ testdir = async_yield_implementation = .patch_code at 0xf4daebb0> def test_async_yield_fixture_within_sync_yield_fixture( testdir, async_yield_implementation ): testdir.makepyfile( async_yield_implementation( """ import pytest import trio from async_generator import async_generator, yield_ events = [] @pytest.fixture @async_generator async def fix2(): events.append('fix2 setup') await trio.sleep(0) await yield_('fix2') await trio.sleep(0) events.append('fix2 teardown') @pytest.fixture def fix1(fix2): events.append('fix1 setup') yield 'fix1' events.append('fix1 teardown') def test_before(): assert not events @pytest.mark.trio async def test_actual_test(fix1): assert events == [ 'fix2 setup', 'fix1 setup', ] assert fix1 == 'fix1' def test_after(): assert events == [ 'fix2 setup', 'fix1 setup', 'fix1 teardown', 'fix2 teardown', ] """ ) ) result = testdir.runpytest() > result.assert_outcomes(passed=3) E AssertionError: assert {'errors': 1,\n 'failed': 1,\n 'passed': 1,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} == {'errors': 0,\n 'failed': 0,\n 'passed': 3,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} E Common items: E {'skipped': 0, 'xfailed': 0, 'xpassed': 0} E Differing items: E {'errors': 1} != {'errors': 0} E {'passed': 1} != {'passed': 3} E {'failed': 1} != {'failed': 0} E Full diff: E { E - 'errors': 0, E ? ^ E + 'errors': 1, E ? ^ E - 'failed': 0, E ? ^ E + 'failed': 1, E ? ^ E - 'passed': 3, E ? ^ E + 'passed': 1, E ? ^ E 'skipped': 0, E 'xfailed': 0, E 'xpassed': 0, E } async_yield_implementation = .patch_code at 0xf4daebb0> result = testdir = /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0/pytest_trio/_tests/test_async_yield_fixture.py:230: AssertionError -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- ==================================================================== test session starts ===================================================================== platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/pytest-of-portage/pytest-0/test_async_yield_fixture_within_sync_yield_fixture0 plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1 collected 3 items test_async_yield_fixture_within_sync_yield_fixture.py .EF [100%] =========================================================================== ERRORS =========================================================================== _____________________________________________________________ ERROR at setup of test_actual_test _____________________________________________________________ @pytest.fixture async def fix2(): events.append('fix2 setup') > await trio.sleep(0) test_async_yield_fixture_within_sync_yield_fixture.py:10: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/trio/_timeouts.py:74: in sleep await trio.lowlevel.checkpoint() /usr/lib/python3.8/site-packages/trio/_core/_run.py:2332: in checkpoint await cancel_shielded_checkpoint() /usr/lib/python3.8/site-packages/trio/_core/_traps.py:43: in cancel_shielded_checkpoint return (await _async_yield(CancelShieldedCheckpoint)).unwrap() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ obj = @types.coroutine def _async_yield(obj): > return (yield obj) E RuntimeError: Task got bad yield: /usr/lib/python3.8/site-packages/trio/_core/_traps.py:21: RuntimeError ========================================================================== FAILURES ========================================================================== _________________________________________________________________________ test_after _________________________________________________________________________ def test_after(): > assert events == [ 'fix2 setup', 'fix1 setup', 'fix1 teardown', 'fix2 teardown', ] E AssertionError: assert ['fix2 setup'] == ['fix2 setup'...ix2 teardown'] E Right contains 3 more items, first extra item: 'fix1 setup' E Use -v to get the full diff test_async_yield_fixture_within_sync_yield_fixture.py:35: AssertionError ================================================================== short test summary info =================================================================== FAILED test_async_yield_fixture_within_sync_yield_fixture.py::test_after - AssertionError: assert ['fix2 setup'] == ['fix2 setup'...ix2 teardown'] ERROR test_async_yield_fixture_within_sync_yield_fixture.py::test_actual_test - RuntimeError: Task got bad yield: =36] __________________________________________________ testdir = async_yield_implementation = .patch_code at 0xf4d6abf8> def test_async_yield_fixture_with_multiple_yields( testdir, async_yield_implementation ): testdir.makepyfile( async_yield_implementation( """ import pytest import trio from async_generator import async_generator, yield_ @pytest.fixture @async_generator async def fix1(): await trio.sleep(0) await yield_('good') await trio.sleep(0) await yield_('bad') @pytest.mark.trio async def test_actual_test(fix1): pass """ ) ) result = testdir.runpytest() # TODO: should trigger error instead of failure # result.assert_outcomes(errors=1) > result.assert_outcomes(failed=1) E AssertionError: assert {'errors': 1,\n 'failed': 0,\n 'passed': 0,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} == {'errors': 0,\n 'failed': 1,\n 'passed': 0,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} E Common items: E {'passed': 0, 'skipped': 0, 'xfailed': 0, 'xpassed': 0} E Differing items: E {'errors': 1} != {'errors': 0} E {'failed': 0} != {'failed': 1} E Full diff: E { E - 'errors': 0, E ? ^ E + 'errors': 1, E ? ^ E - 'failed': 1, E ? ^ E + 'failed': 0, E ? ^ E 'passed': 0, E 'skipped': 0, E 'xfailed': 0, E 'xpassed': 0, E } async_yield_implementation = .patch_code at 0xf4d6abf8> result = testdir = /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0/pytest_trio/_tests/test_async_yield_fixture.py:263: AssertionError -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- ==================================================================== test session starts ===================================================================== platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/pytest-of-portage/pytest-0/test_async_yield_fixture_with_multiple_yields0 plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1 collected 1 item test_async_yield_fixture_with_multiple_yields.py E [100%] =========================================================================== ERRORS =========================================================================== _____________________________________________________________ ERROR at setup of test_actual_test _____________________________________________________________ @pytest.fixture async def fix1(): > await trio.sleep(0) test_async_yield_fixture_with_multiple_yields.py:7: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/trio/_timeouts.py:74: in sleep await trio.lowlevel.checkpoint() /usr/lib/python3.8/site-packages/trio/_core/_run.py:2332: in checkpoint await cancel_shielded_checkpoint() /usr/lib/python3.8/site-packages/trio/_core/_traps.py:43: in cancel_shielded_checkpoint return (await _async_yield(CancelShieldedCheckpoint)).unwrap() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ obj = @types.coroutine def _async_yield(obj): > return (yield obj) E RuntimeError: Task got bad yield: /usr/lib/python3.8/site-packages/trio/_core/_traps.py:21: RuntimeError ================================================================== short test summary info =================================================================== ERROR test_async_yield_fixture_with_multiple_yields.py::test_actual_test - RuntimeError: Task got bad yield: =36] ______________________________________________________ testdir = async_yield_implementation = .patch_code at 0xf4c5a268> def test_async_yield_fixture_with_nursery(testdir, async_yield_implementation): testdir.makepyfile( async_yield_implementation( """ import pytest import trio from async_generator import async_generator, yield_ async def handle_client(stream): while True: buff = await stream.receive_some(4) await stream.send_all(buff) @pytest.fixture @async_generator async def server(): async with trio.open_nursery() as nursery: listeners = await nursery.start(trio.serve_tcp, handle_client, 0) await yield_(listeners[0]) nursery.cancel_scope.cancel() @pytest.mark.trio async def test_actual_test(server): stream = await trio.testing.open_stream_to_socket_listener(server) await stream.send_all(b'ping') rep = await stream.receive_some(4) assert rep == b'ping' """ ) ) result = testdir.runpytest() > result.assert_outcomes(passed=1) E AssertionError: assert {'errors': 1,\n 'failed': 0,\n 'passed': 0,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} == {'errors': 0,\n 'failed': 0,\n 'passed': 1,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} E Common items: E {'failed': 0, 'skipped': 0, 'xfailed': 0, 'xpassed': 0} E Differing items: E {'errors': 1} != {'errors': 0} E {'passed': 0} != {'passed': 1} E Full diff: E { E - 'errors': 0, E ? ^ E + 'errors': 1, E ? ^ E 'failed': 0, E - 'passed': 1, E ? ^ E + 'passed': 0, E ? ^ E 'skipped': 0, E 'xfailed': 0, E 'xpassed': 0, E } async_yield_implementation = .patch_code at 0xf4c5a268> result = testdir = /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0/pytest_trio/_tests/test_async_yield_fixture.py:303: AssertionError -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- ==================================================================== test session starts ===================================================================== platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/pytest-of-portage/pytest-0/test_async_yield_fixture_with_nursery0 plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1 collected 1 item test_async_yield_fixture_with_nursery.py E [100%] =========================================================================== ERRORS =========================================================================== _____________________________________________________________ ERROR at setup of test_actual_test _____________________________________________________________ @pytest.fixture async def server(): > async with trio.open_nursery() as nursery: test_async_yield_fixture_with_nursery.py:14: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/trio/_core/_run.py:796: in __aenter__ self._scope.__enter__() /usr/lib/python3.8/site-packages/trio/_core/_ki.py:159: in wrapper return fn(*args, **kwargs) /usr/lib/python3.8/site-packages/trio/_core/_run.py:449: in __enter__ task = _core.current_task() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ def current_task(): """Return the :class:`Task` object representing the current task. Returns: Task: the :class:`Task` that called :func:`current_task`. """ try: return GLOBAL_RUN_CONTEXT.task except AttributeError: > raise RuntimeError("must be called from async context") from None E RuntimeError: must be called from async context /usr/lib/python3.8/site-packages/trio/_core/_run.py:2285: RuntimeError ================================================================== short test summary info =================================================================== ERROR test_async_yield_fixture_with_nursery.py::test_actual_test - RuntimeError: must be called from async context ====================================================================== 1 error in 0.35s ====================================================================== ________________________________________ test_async_yield_fixture_crashed_teardown_allow_other_teardowns[Python>=36] _________________________________________ testdir = async_yield_implementation = .patch_code at 0xf4a1b100> def test_async_yield_fixture_crashed_teardown_allow_other_teardowns( testdir, async_yield_implementation ): testdir.makepyfile( async_yield_implementation( """ import pytest import trio from async_generator import async_generator, yield_ setup_events = set() teardown_events = set() @pytest.fixture @async_generator async def good_fixture(): async with trio.open_nursery() as nursery: setup_events.add('good_fixture setup') await yield_(None) teardown_events.add('good_fixture teardown') @pytest.fixture @async_generator async def bad_fixture(): async with trio.open_nursery() as nursery: setup_events.add('bad_fixture setup') await yield_(None) teardown_events.add('bad_fixture teardown') raise RuntimeError('Crash during fixture teardown') def test_before(): assert not setup_events assert not teardown_events @pytest.mark.trio async def test_actual_test(bad_fixture, good_fixture): pass def test_after(): assert setup_events == { 'good_fixture setup', 'bad_fixture setup', } assert teardown_events == { 'bad_fixture teardown', 'good_fixture teardown', } """ ) ) result = testdir.runpytest() > result.assert_outcomes(failed=1, passed=2) E AssertionError: assert {'errors': 1,\n 'failed': 1,\n 'passed': 1,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} == {'errors': 0,\n 'failed': 1,\n 'passed': 2,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} E Common items: E {'failed': 1, 'skipped': 0, 'xfailed': 0, 'xpassed': 0} E Differing items: E {'errors': 1} != {'errors': 0} E {'passed': 1} != {'passed': 2} E Full diff: E { E - 'errors': 0, E ? ^ E + 'errors': 1, E ? ^ E 'failed': 1, E - 'passed': 2, E ? ^ E + 'passed': 1, E ? ^ E 'skipped': 0, E 'xfailed': 0, E 'xpassed': 0, E } async_yield_implementation = .patch_code at 0xf4a1b100> result = testdir = /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0/pytest_trio/_tests/test_async_yield_fixture.py:360: AssertionError -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- ==================================================================== test session starts ===================================================================== platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/pytest-of-portage/pytest-0/test_async_yield_fixture_crashed_teardown_allow_other_teardowns0 plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1 collected 3 items test_async_yield_fixture_crashed_teardown_allow_other_teardowns.py .EF [100%] =========================================================================== ERRORS =========================================================================== _____________________________________________________________ ERROR at setup of test_actual_test _____________________________________________________________ @pytest.fixture async def bad_fixture(): > async with trio.open_nursery() as nursery: test_async_yield_fixture_crashed_teardown_allow_other_teardowns.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/trio/_core/_run.py:796: in __aenter__ self._scope.__enter__() /usr/lib/python3.8/site-packages/trio/_core/_ki.py:159: in wrapper return fn(*args, **kwargs) /usr/lib/python3.8/site-packages/trio/_core/_run.py:449: in __enter__ task = _core.current_task() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ def current_task(): """Return the :class:`Task` object representing the current task. Returns: Task: the :class:`Task` that called :func:`current_task`. """ try: return GLOBAL_RUN_CONTEXT.task except AttributeError: > raise RuntimeError("must be called from async context") from None E RuntimeError: must be called from async context /usr/lib/python3.8/site-packages/trio/_core/_run.py:2285: RuntimeError ========================================================================== FAILURES ========================================================================== _________________________________________________________________________ test_after _________________________________________________________________________ def test_after(): > assert setup_events == { 'good_fixture setup', 'bad_fixture setup', } E AssertionError: assert set() == {'bad_fixture...ixture setup'} E Extra items in the right set: E 'bad_fixture setup' E 'good_fixture setup' E Use -v to get the full diff test_async_yield_fixture_crashed_teardown_allow_other_teardowns.py:32: AssertionError ================================================================== short test summary info =================================================================== FAILED test_async_yield_fixture_crashed_teardown_allow_other_teardowns.py::test_after - AssertionError: assert set() == {'bad_fixture...ixture setup'} ERROR test_async_yield_fixture_crashed_teardown_allow_other_teardowns.py::test_actual_test - RuntimeError: must be called from async context ============================================================ 1 failed, 1 passed, 1 error in 0.39s ============================================================ ______________________________________________________________ test_async_test_as_class_method _______________________________________________________________ testdir = def test_async_test_as_class_method(testdir): testdir.makepyfile( """ import pytest import trio async_test_called = False @pytest.fixture async def fix(): await trio.sleep(0) return 'fix' class TestInClass: @pytest.mark.trio async def test_base(self, fix): global async_test_called assert fix == 'fix' await trio.sleep(0) async_test_called = True def test_check_async_test_called(): assert async_test_called """ ) result = testdir.runpytest() > result.assert_outcomes(passed=2) E AssertionError: assert {'errors': 1,\n 'failed': 1,\n 'passed': 0,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} == {'errors': 0,\n 'failed': 0,\n 'passed': 2,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} E Common items: E {'skipped': 0, 'xfailed': 0, 'xpassed': 0} E Differing items: E {'errors': 1} != {'errors': 0} E {'passed': 0} != {'passed': 2} E {'failed': 1} != {'failed': 0} E Full diff: E { E - 'errors': 0, E ? ^ E + 'errors': 1, E ? ^ E - 'failed': 0, E ? ^ E + 'failed': 1, E ? ^ E - 'passed': 2, E ? ^ E + 'passed': 0, E ? ^ E 'skipped': 0, E 'xfailed': 0, E 'xpassed': 0, E } result = testdir = /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0/pytest_trio/_tests/test_basic.py:58: AssertionError -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- ==================================================================== test session starts ===================================================================== platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/pytest-of-portage/pytest-0/test_async_test_as_class_method0 plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1 collected 2 items test_async_test_as_class_method.py EF [100%] =========================================================================== ERRORS =========================================================================== __________________________________________________________ ERROR at setup of TestInClass.test_base ___________________________________________________________ @pytest.fixture async def fix(): > await trio.sleep(0) test_async_test_as_class_method.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/trio/_timeouts.py:74: in sleep await trio.lowlevel.checkpoint() /usr/lib/python3.8/site-packages/trio/_core/_run.py:2332: in checkpoint await cancel_shielded_checkpoint() /usr/lib/python3.8/site-packages/trio/_core/_traps.py:43: in cancel_shielded_checkpoint return (await _async_yield(CancelShieldedCheckpoint)).unwrap() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ obj = @types.coroutine def _async_yield(obj): > return (yield obj) E RuntimeError: Task got bad yield: /usr/lib/python3.8/site-packages/trio/_core/_traps.py:21: RuntimeError ========================================================================== FAILURES ========================================================================== ________________________________________________________________ test_check_async_test_called ________________________________________________________________ def test_check_async_test_called(): > assert async_test_called E assert False test_async_test_as_class_method.py:20: AssertionError ================================================================== short test summary info =================================================================== FAILED test_async_test_as_class_method.py::test_check_async_test_called - assert False ERROR test_async_test_as_class_method.py::TestInClass::test_base - RuntimeError: Task got bad yield: ================================================================= 1 failed, 1 error in 0.33s ================================================================= ____________________________________________________ test_trio_fixture_with_wrong_scope_without_trio_mode ____________________________________________________ testdir = def test_trio_fixture_with_wrong_scope_without_trio_mode(testdir): # There's a trick here: when you have a non-function-scope fixture, it's # not instantiated for any particular function (obviously). So... when our # pytest_fixture_setup hook tries to check for marks, it can't normally # see @pytest.mark.trio. So... it's actually almost impossible to have an # async fixture get treated as a Trio fixture *and* have it be # non-function-scope. But, class-scoped fixtures can see marks on the # class, so this is one way (the only way?) it can happen: testdir.makepyfile( """ import pytest @pytest.fixture(scope="class") async def async_class_fixture(): pass @pytest.mark.trio class TestFoo: async def test_foo(self, async_class_fixture): pass """ ) result = testdir.runpytest() result.assert_outcomes(errors=1) > result.stdout.fnmatch_lines(["*: Trio fixtures must be function-scope*"]) E Failed: nomatch: '*: Trio fixtures must be function-scope*' E and: '==================================================================== test session starts =====================================================================' E and: 'platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1' E and: 'rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/pytest-of-portage/pytest-0/test_trio_fixture_with_wrong_scope_without_trio_mode0' E and: 'plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1' E and: 'collected 1 item' E and: '' E and: 'test_trio_fixture_with_wrong_scope_without_trio_mode.py E [100%]' E and: '' E and: '=========================================================================== ERRORS ===========================================================================' E and: '_____________________________________________________________ ERROR at setup of TestFoo.test_foo _____________________________________________________________' E and: "ScopeMismatch: You tried to access the 'function' scoped fixture 'event_loop' with a 'class' scoped request object, involved factories" E and: '../../../../../../../../../usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:151: def wrapper(*args, **kwargs)' E and: '../../../../../../../../../usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:224: def event_loop(request)' E and: '================================================================== short test summary info ===================================================================' E and: 'ERROR test_trio_fixture_with_wrong_scope_without_trio_mode.py::TestFoo::test_foo' E and: '====================================================================== 1 error in 0.08s ======================================================================' E remains unmatched: '*: Trio fixtures must be function-scope*' result = testdir = /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0/pytest_trio/_tests/test_fixture_mistakes.py:69: Failed -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- ==================================================================== test session starts ===================================================================== platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/pytest-of-portage/pytest-0/test_trio_fixture_with_wrong_scope_without_trio_mode0 plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1 collected 1 item test_trio_fixture_with_wrong_scope_without_trio_mode.py E [100%] =========================================================================== ERRORS =========================================================================== _____________________________________________________________ ERROR at setup of TestFoo.test_foo _____________________________________________________________ ScopeMismatch: You tried to access the 'function' scoped fixture 'event_loop' with a 'class' scoped request object, involved factories ../../../../../../../../../usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:151: def wrapper(*args, **kwargs) ../../../../../../../../../usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:224: def event_loop(request) ================================================================== short test summary info =================================================================== ERROR test_trio_fixture_with_wrong_scope_without_trio_mode.py::TestFoo::test_foo ====================================================================== 1 error in 0.08s ====================================================================== ______________________________________ test_trio_fixture_with_wrong_scope_in_trio_mode[enable_trio_mode_via_pytest_ini] ______________________________________ testdir = enable_trio_mode = @enable_trio_mode def test_trio_fixture_with_wrong_scope_in_trio_mode(testdir, enable_trio_mode): enable_trio_mode(testdir) testdir.makepyfile( """ import pytest @pytest.fixture(scope="session") async def async_session_fixture(): pass async def test_whatever(async_session_fixture): pass """ ) result = testdir.runpytest() result.assert_outcomes(errors=1) > result.stdout.fnmatch_lines(["*: Trio fixtures must be function-scope*"]) E Failed: nomatch: '*: Trio fixtures must be function-scope*' E and: '==================================================================== test session starts =====================================================================' E and: 'platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1' E and: 'rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/pytest-of-portage/pytest-0/test_trio_fixture_with_wrong_scope_in_trio_mode0, configfile: pytest.ini' E and: 'plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1' E and: 'collected 1 item' E and: '' E and: 'test_trio_fixture_with_wrong_scope_in_trio_mode.py E [100%]' E and: '' E and: '=========================================================================== ERRORS ===========================================================================' E and: '______________________________________________________________ ERROR at setup of test_whatever _______________________________________________________________' E and: "ScopeMismatch: You tried to access the 'function' scoped fixture 'event_loop' with a 'session' scoped request object, involved factories" E and: '../../../../../../../../../usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:151: def wrapper(*args, **kwargs)' E and: '../../../../../../../../../usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:224: def event_loop(request)' E and: '================================================================== short test summary info ===================================================================' E and: 'ERROR test_trio_fixture_with_wrong_scope_in_trio_mode.py::test_whatever' E and: '====================================================================== 1 error in 0.08s ======================================================================' E remains unmatched: '*: Trio fixtures must be function-scope*' enable_trio_mode = result = testdir = /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0/pytest_trio/_tests/test_fixture_mistakes.py:93: Failed -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- ==================================================================== test session starts ===================================================================== platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/pytest-of-portage/pytest-0/test_trio_fixture_with_wrong_scope_in_trio_mode0, configfile: pytest.ini plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1 collected 1 item test_trio_fixture_with_wrong_scope_in_trio_mode.py E [100%] =========================================================================== ERRORS =========================================================================== ______________________________________________________________ ERROR at setup of test_whatever _______________________________________________________________ ScopeMismatch: You tried to access the 'function' scoped fixture 'event_loop' with a 'session' scoped request object, involved factories ../../../../../../../../../usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:151: def wrapper(*args, **kwargs) ../../../../../../../../../usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:224: def event_loop(request) ================================================================== short test summary info =================================================================== ERROR test_trio_fixture_with_wrong_scope_in_trio_mode.py::test_whatever ====================================================================== 1 error in 0.08s ====================================================================== _________________________________ test_trio_fixture_with_wrong_scope_in_trio_mode[enable_trio_mode_trio_run_via_pytest_ini] __________________________________ testdir = enable_trio_mode = @enable_trio_mode def test_trio_fixture_with_wrong_scope_in_trio_mode(testdir, enable_trio_mode): enable_trio_mode(testdir) testdir.makepyfile( """ import pytest @pytest.fixture(scope="session") async def async_session_fixture(): pass async def test_whatever(async_session_fixture): pass """ ) result = testdir.runpytest() result.assert_outcomes(errors=1) > result.stdout.fnmatch_lines(["*: Trio fixtures must be function-scope*"]) E Failed: nomatch: '*: Trio fixtures must be function-scope*' E and: '==================================================================== test session starts =====================================================================' E and: 'platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1' E and: 'rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/pytest-of-portage/pytest-0/test_trio_fixture_with_wrong_scope_in_trio_mode1, configfile: pytest.ini' E and: 'plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1' E and: 'collected 1 item' E and: '' E and: 'test_trio_fixture_with_wrong_scope_in_trio_mode.py E [100%]' E and: '' E and: '=========================================================================== ERRORS ===========================================================================' E and: '______________________________________________________________ ERROR at setup of test_whatever _______________________________________________________________' E and: "ScopeMismatch: You tried to access the 'function' scoped fixture 'event_loop' with a 'session' scoped request object, involved factories" E and: '../../../../../../../../../usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:151: def wrapper(*args, **kwargs)' E and: '../../../../../../../../../usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:224: def event_loop(request)' E and: '================================================================== short test summary info ===================================================================' E and: 'ERROR test_trio_fixture_with_wrong_scope_in_trio_mode.py::test_whatever' E and: '====================================================================== 1 error in 0.07s ======================================================================' E remains unmatched: '*: Trio fixtures must be function-scope*' enable_trio_mode = result = testdir = /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0/pytest_trio/_tests/test_fixture_mistakes.py:93: Failed -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- ==================================================================== test session starts ===================================================================== platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/pytest-of-portage/pytest-0/test_trio_fixture_with_wrong_scope_in_trio_mode1, configfile: pytest.ini plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1 collected 1 item test_trio_fixture_with_wrong_scope_in_trio_mode.py E [100%] =========================================================================== ERRORS =========================================================================== ______________________________________________________________ ERROR at setup of test_whatever _______________________________________________________________ ScopeMismatch: You tried to access the 'function' scoped fixture 'event_loop' with a 'session' scoped request object, involved factories ../../../../../../../../../usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:151: def wrapper(*args, **kwargs) ../../../../../../../../../usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:224: def event_loop(request) ================================================================== short test summary info =================================================================== ERROR test_trio_fixture_with_wrong_scope_in_trio_mode.py::test_whatever ====================================================================== 1 error in 0.07s ====================================================================== _____________________________________ test_trio_fixture_with_wrong_scope_in_trio_mode[enable_trio_mode_via_conftest_py] ______________________________________ testdir = enable_trio_mode = @enable_trio_mode def test_trio_fixture_with_wrong_scope_in_trio_mode(testdir, enable_trio_mode): enable_trio_mode(testdir) testdir.makepyfile( """ import pytest @pytest.fixture(scope="session") async def async_session_fixture(): pass async def test_whatever(async_session_fixture): pass """ ) result = testdir.runpytest() result.assert_outcomes(errors=1) > result.stdout.fnmatch_lines(["*: Trio fixtures must be function-scope*"]) E Failed: nomatch: '*: Trio fixtures must be function-scope*' E and: '==================================================================== test session starts =====================================================================' E and: 'platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1' E and: 'rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/pytest-of-portage/pytest-0/test_trio_fixture_with_wrong_scope_in_trio_mode2' E and: 'plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1' E and: 'collected 1 item' E and: '' E and: 'test_trio_fixture_with_wrong_scope_in_trio_mode.py E [100%]' E and: '' E and: '=========================================================================== ERRORS ===========================================================================' E and: '______________________________________________________________ ERROR at setup of test_whatever _______________________________________________________________' E and: "ScopeMismatch: You tried to access the 'function' scoped fixture 'event_loop' with a 'session' scoped request object, involved factories" E and: '../../../../../../../../../usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:151: def wrapper(*args, **kwargs)' E and: '../../../../../../../../../usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:224: def event_loop(request)' E and: '================================================================== short test summary info ===================================================================' E and: 'ERROR test_trio_fixture_with_wrong_scope_in_trio_mode.py::test_whatever' E and: '====================================================================== 1 error in 0.07s ======================================================================' E remains unmatched: '*: Trio fixtures must be function-scope*' enable_trio_mode = result = testdir = /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0/pytest_trio/_tests/test_fixture_mistakes.py:93: Failed -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- ==================================================================== test session starts ===================================================================== platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/pytest-of-portage/pytest-0/test_trio_fixture_with_wrong_scope_in_trio_mode2 plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1 collected 1 item test_trio_fixture_with_wrong_scope_in_trio_mode.py E [100%] =========================================================================== ERRORS =========================================================================== ______________________________________________________________ ERROR at setup of test_whatever _______________________________________________________________ ScopeMismatch: You tried to access the 'function' scoped fixture 'event_loop' with a 'session' scoped request object, involved factories ../../../../../../../../../usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:151: def wrapper(*args, **kwargs) ../../../../../../../../../usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:224: def event_loop(request) ================================================================== short test summary info =================================================================== ERROR test_trio_fixture_with_wrong_scope_in_trio_mode.py::test_whatever ====================================================================== 1 error in 0.07s ====================================================================== ______________________________________ test_async_fixture_with_sync_test_in_trio_mode[enable_trio_mode_via_pytest_ini] _______________________________________ testdir = enable_trio_mode = @enable_trio_mode def test_async_fixture_with_sync_test_in_trio_mode(testdir, enable_trio_mode): enable_trio_mode(testdir) testdir.makepyfile( """ import pytest @pytest.fixture async def async_fixture(): pass def test_whatever(async_fixture): pass """ ) result = testdir.runpytest() > result.assert_outcomes(errors=1) E AssertionError: assert {'errors': 0,\n 'failed': 0,\n 'passed': 1,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} == {'errors': 1,\n 'failed': 0,\n 'passed': 0,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} E Common items: E {'failed': 0, 'skipped': 0, 'xfailed': 0, 'xpassed': 0} E Differing items: E {'errors': 0} != {'errors': 1} E {'passed': 1} != {'passed': 0} E Full diff: E { E - 'errors': 1, E ? ^ E + 'errors': 0, E ? ^ E 'failed': 0, E - 'passed': 0, E ? ^ E + 'passed': 1, E ? ^ E 'skipped': 0, E 'xfailed': 0, E 'xpassed': 0, E } enable_trio_mode = result = testdir = /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0/pytest_trio/_tests/test_fixture_mistakes.py:116: AssertionError -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- ==================================================================== test session starts ===================================================================== platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/pytest-of-portage/pytest-0/test_async_fixture_with_sync_test_in_trio_mode0, configfile: pytest.ini plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1 collected 1 item test_async_fixture_with_sync_test_in_trio_mode.py . [100%] ===================================================================== 1 passed in 0.05s ====================================================================== __________________________________ test_async_fixture_with_sync_test_in_trio_mode[enable_trio_mode_trio_run_via_pytest_ini] __________________________________ testdir = enable_trio_mode = @enable_trio_mode def test_async_fixture_with_sync_test_in_trio_mode(testdir, enable_trio_mode): enable_trio_mode(testdir) testdir.makepyfile( """ import pytest @pytest.fixture async def async_fixture(): pass def test_whatever(async_fixture): pass """ ) result = testdir.runpytest() > result.assert_outcomes(errors=1) E AssertionError: assert {'errors': 0,\n 'failed': 0,\n 'passed': 1,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} == {'errors': 1,\n 'failed': 0,\n 'passed': 0,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} E Common items: E {'failed': 0, 'skipped': 0, 'xfailed': 0, 'xpassed': 0} E Differing items: E {'errors': 0} != {'errors': 1} E {'passed': 1} != {'passed': 0} E Full diff: E { E - 'errors': 1, E ? ^ E + 'errors': 0, E ? ^ E 'failed': 0, E - 'passed': 0, E ? ^ E + 'passed': 1, E ? ^ E 'skipped': 0, E 'xfailed': 0, E 'xpassed': 0, E } enable_trio_mode = result = testdir = /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0/pytest_trio/_tests/test_fixture_mistakes.py:116: AssertionError -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- ==================================================================== test session starts ===================================================================== platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/pytest-of-portage/pytest-0/test_async_fixture_with_sync_test_in_trio_mode1, configfile: pytest.ini plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1 collected 1 item test_async_fixture_with_sync_test_in_trio_mode.py . [100%] ===================================================================== 1 passed in 0.05s ====================================================================== ______________________________________ test_async_fixture_with_sync_test_in_trio_mode[enable_trio_mode_via_conftest_py] ______________________________________ testdir = enable_trio_mode = @enable_trio_mode def test_async_fixture_with_sync_test_in_trio_mode(testdir, enable_trio_mode): enable_trio_mode(testdir) testdir.makepyfile( """ import pytest @pytest.fixture async def async_fixture(): pass def test_whatever(async_fixture): pass """ ) result = testdir.runpytest() > result.assert_outcomes(errors=1) E AssertionError: assert {'errors': 0,\n 'failed': 0,\n 'passed': 1,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} == {'errors': 1,\n 'failed': 0,\n 'passed': 0,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} E Common items: E {'failed': 0, 'skipped': 0, 'xfailed': 0, 'xpassed': 0} E Differing items: E {'errors': 0} != {'errors': 1} E {'passed': 1} != {'passed': 0} E Full diff: E { E - 'errors': 1, E ? ^ E + 'errors': 0, E ? ^ E 'failed': 0, E - 'passed': 0, E ? ^ E + 'passed': 1, E ? ^ E 'skipped': 0, E 'xfailed': 0, E 'xpassed': 0, E } enable_trio_mode = result = testdir = /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0/pytest_trio/_tests/test_fixture_mistakes.py:116: AssertionError -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- ==================================================================== test session starts ===================================================================== platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/pytest-of-portage/pytest-0/test_async_fixture_with_sync_test_in_trio_mode2 plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1 collected 1 item test_async_fixture_with_sync_test_in_trio_mode.py . [100%] ===================================================================== 1 passed in 0.06s ====================================================================== __________________________________________________________________________ test_try __________________________________________________________________________ runner = Runner(clock=SystemClock(offset=126687.6110713156), instruments={'_all': {}}, io_manager=EpollIOManager(_epoll=._bootstrap_fixtures_and_run_test at 0xf45dbec8>, server=) args = (), host_uses_signal_set_wakeup_fd = False def unrolled_run(runner, async_fn, args, host_uses_signal_set_wakeup_fd=False): locals()[LOCALS_KEY_KI_PROTECTION_ENABLED] = True __tracebackhide__ = True try: if not host_uses_signal_set_wakeup_fd: runner.entry_queue.wakeup.wakeup_on_signals() if "before_run" in runner.instruments: runner.instruments.call("before_run") runner.clock.start_clock() runner.init_task = runner.spawn_impl( runner.init, (async_fn, args), None, "", system_task=True ) # You know how people talk about "event loops"? This 'while' loop right # here is our event loop: while runner.tasks: if runner.runq: timeout = 0 else: deadline = runner.deadlines.next_deadline() timeout = runner.clock.deadline_to_sleep_time(deadline) timeout = min(max(0, timeout), _MAX_TIMEOUT) idle_primed = None if runner.waiting_for_idle: cushion, _ = runner.waiting_for_idle.keys()[0] if cushion < timeout: timeout = cushion idle_primed = IdlePrimedTypes.WAITING_FOR_IDLE # We use 'elif' here because if there are tasks in # wait_all_tasks_blocked, then those tasks will wake up without # jumping the clock, so we don't need to autojump. elif runner.clock_autojump_threshold < timeout: timeout = runner.clock_autojump_threshold idle_primed = IdlePrimedTypes.AUTOJUMP_CLOCK if "before_io_wait" in runner.instruments: runner.instruments.call("before_io_wait", timeout) # Driver will call io_manager.get_events(timeout) and pass it back # in through the yield events = yield timeout runner.io_manager.process_events(events) if "after_io_wait" in runner.instruments: runner.instruments.call("after_io_wait", timeout) # Process cancellations due to deadline expiry now = runner.clock.current_time() if runner.deadlines.expire(now): idle_primed = None # idle_primed != None means: if the IO wait hit the timeout, and # still nothing is happening, then we should start waking up # wait_all_tasks_blocked tasks or autojump the clock. But there # are some subtleties in defining "nothing is happening". # # 'not runner.runq' means that no tasks are currently runnable. # 'not events' means that the last IO wait call hit its full # timeout. These are very similar, and if idle_primed != None and # we're running in regular mode then they always go together. But, # in *guest* mode, they can happen independently, even when # idle_primed=True: # # - runner.runq=empty and events=True: the host loop adjusted a # deadline and that forced an IO wakeup before the timeout expired, # even though no actual tasks were scheduled. # # - runner.runq=nonempty and events=False: the IO wait hit its # timeout, but then some code in the host thread rescheduled a task # before we got here. # # So we need to check both. if idle_primed is not None and not runner.runq and not events: if idle_primed is IdlePrimedTypes.WAITING_FOR_IDLE: while runner.waiting_for_idle: key, task = runner.waiting_for_idle.peekitem(0) if key[0] == cushion: del runner.waiting_for_idle[key] runner.reschedule(task) else: break else: assert idle_primed is IdlePrimedTypes.AUTOJUMP_CLOCK runner.clock._autojump() # Process all runnable tasks, but only the ones that are already # runnable now. Anything that becomes runnable during this cycle # needs to wait until the next pass. This avoids various # starvation issues by ensuring that there's never an unbounded # delay between successive checks for I/O. # # Also, we randomize the order of each batch to avoid assumptions # about scheduling order sneaking in. In the long run, I suspect # we'll either (a) use strict FIFO ordering and document that for # predictability/determinism, or (b) implement a more # sophisticated scheduler (e.g. some variant of fair queueing), # for better behavior under load. For now, this is the worst of # both worlds - but it keeps our options open. (If we do decide to # go all in on deterministic scheduling, then there are other # things that will probably need to change too, like the deadlines # tie-breaker and the non-deterministic ordering of # task._notify_queues.) batch = list(runner.runq) runner.runq.clear() if _ALLOW_DETERMINISTIC_SCHEDULING: # We're running under Hypothesis, and pytest-trio has patched # this in to make the scheduler deterministic and avoid flaky # tests. It's not worth the (small) performance cost in normal # operation, since we'll shuffle the list and _r is only # seeded for tests. batch.sort(key=lambda t: t._counter) _r.shuffle(batch) else: # 50% chance of reversing the batch, this way each task # can appear before/after any other task. if _r.random() < 0.5: batch.reverse() while batch: task = batch.pop() GLOBAL_RUN_CONTEXT.task = task if "before_task_step" in runner.instruments: runner.instruments.call("before_task_step", task) next_send_fn = task._next_send_fn next_send = task._next_send task._next_send_fn = task._next_send = None final_outcome = None try: # We used to unwrap the Outcome object here and send/throw # its contents in directly, but it turns out that .throw() # is buggy, at least on CPython 3.6: # https://bugs.python.org/issue29587 # https://bugs.python.org/issue29590 # So now we send in the Outcome object and unwrap it on the # other side. msg = task.context.run(next_send_fn, next_send) except StopIteration as stop_iteration: final_outcome = Value(stop_iteration.value) except BaseException as task_exc: # Store for later, removing uninteresting top frames: 1 # frame we always remove, because it's this function # catching it, and then in addition we remove however many # more Context.run adds. tb = task_exc.__traceback__.tb_next for _ in range(CONTEXT_RUN_TB_FRAMES): tb = tb.tb_next final_outcome = Error(task_exc.with_traceback(tb)) # Remove local refs so that e.g. cancelled coroutine locals # are not kept alive by this frame until another exception # comes along. del tb if final_outcome is not None: # We can't call this directly inside the except: blocks # above, because then the exceptions end up attaching # themselves to other exceptions as __context__ in # unwanted ways. > runner.task_exited(task, final_outcome) __tracebackhide__ = True args = () async_fn = functools.partial(._bootstrap_fixtures_and_run_test at 0xf45dbec8>, server=) batch = [" at 0xf4577758>] events = [] final_outcome = Error(RuntimeError('cannot reuse already awaited coroutine')) host_uses_signal_set_wakeup_fd = False idle_primed = None next_send = Value(None) next_send_fn = now = 785686.1127152985 runner = Runner(clock=SystemClock(offset=126687.6110713156), instruments={'_all': {}}, io_manager=EpollIOManager(_epoll=, _registered=defaultdict(, {17: EpollWaiters(read_task=' at 0xf4577488>, write_task=None, current_flags=1)}), _force_wakeup=, _force_wakeup_fd=15), ki_manager=KIManager(handler=None), _locals={}, runq=deque([" at 0xf4577708>]), tasks={' at 0xf4577488>, ' at 0xf45776b8>, " at 0xf4577708>, " at 0xf4577758>, ._bootstrap_fixtures_and_run_test' at 0xf45777f8>}, deadlines=Deadlines(_heap=[], _active=0), init_task=' at 0xf45776b8>, system_nursery=, system_context=, main_task=._bootstrap_fixtures_and_run_test' at 0xf45777f8>, main_task_outcome=None, entry_queue=EntryQueue(queue=deque([]), idempotent_queue={}, wakeup=, done=False, lock=), trio_token=None, asyncgens=AsyncGenerators(alive={, }, trailing_needs_finalize=set(), prev_hooks=asyncgen_hooks(firstiter=None, finalizer=None)), clock_autojump_threshold=inf, is_guest=False, guest_tick_scheduled=False, ki_pending=False, waiting_for_idle=SortedDict({})) task = " at 0xf45773e8> timeout = 0 /usr/lib/python3.8/site-packages/trio/_core/_run.py:2189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Runner(clock=SystemClock(offset=126687.6110713156), instruments={'_all': {}}, io_manager=EpollIOManager(_epoll=" at 0xf45773e8>, outcome = Error(RuntimeError('cannot reuse already awaited coroutine')) def task_exited(self, task, outcome): if ( task._cancel_status is not None and task._cancel_status.abandoned_by_misnesting and task._cancel_status.parent is None ): # The cancel scope surrounding this task's nursery was closed # before the task exited. Force the task to exit with an error, # since the error might not have been caught elsewhere. See the # comments in CancelStatus.close(). try: # Raise this, rather than just constructing it, to get a # traceback frame included raise RuntimeError( "Cancel scope stack corrupted: cancel scope surrounding " "{!r} was closed before the task exited\n{}".format( task, MISNESTING_ADVICE ) ) except RuntimeError as new_exc: if isinstance(outcome, Error): new_exc.__context__ = outcome.error outcome = Error(new_exc) task._activate_cancel_status(None) > self.tasks.remove(task) E KeyError: " at 0xf45773e8> outcome = Error(RuntimeError('cannot reuse already awaited coroutine')) self = Runner(clock=SystemClock(offset=126687.6110713156), instruments={'_all': {}}, io_manager=EpollIOManager(_epoll=, _registered=defaultdict(, {17: EpollWaiters(read_task=' at 0xf4577488>, write_task=None, current_flags=1)}), _force_wakeup=, _force_wakeup_fd=15), ki_manager=KIManager(handler=None), _locals={}, runq=deque([" at 0xf4577708>]), tasks={' at 0xf4577488>, ' at 0xf45776b8>, " at 0xf4577708>, " at 0xf4577758>, ._bootstrap_fixtures_and_run_test' at 0xf45777f8>}, deadlines=Deadlines(_heap=[], _active=0), init_task=' at 0xf45776b8>, system_nursery=, system_context=, main_task=._bootstrap_fixtures_and_run_test' at 0xf45777f8>, main_task_outcome=None, entry_queue=EntryQueue(queue=deque([]), idempotent_queue={}, wakeup=, done=False, lock=), trio_token=None, asyncgens=AsyncGenerators(alive={, }, trailing_needs_finalize=set(), prev_hooks=asyncgen_hooks(firstiter=None, finalizer=None)), clock_autojump_threshold=inf, is_guest=False, guest_tick_scheduled=False, ki_pending=False, waiting_for_idle=SortedDict({})) task = " at 0xf45773e8> /usr/lib/python3.8/site-packages/trio/_core/_run.py:1506: KeyError The above exception was the direct cause of the following exception: runner = Runner(clock=SystemClock(offset=126687.6110713156), instruments={'_all': {}}, io_manager=EpollIOManager(_epoll=._bootstrap_fixtures_and_run_test at 0xf45dbec8>, server=) args = (), host_uses_signal_set_wakeup_fd = False def unrolled_run(runner, async_fn, args, host_uses_signal_set_wakeup_fd=False): locals()[LOCALS_KEY_KI_PROTECTION_ENABLED] = True __tracebackhide__ = True try: if not host_uses_signal_set_wakeup_fd: runner.entry_queue.wakeup.wakeup_on_signals() if "before_run" in runner.instruments: runner.instruments.call("before_run") runner.clock.start_clock() runner.init_task = runner.spawn_impl( runner.init, (async_fn, args), None, "", system_task=True ) # You know how people talk about "event loops"? This 'while' loop right # here is our event loop: while runner.tasks: if runner.runq: timeout = 0 else: deadline = runner.deadlines.next_deadline() timeout = runner.clock.deadline_to_sleep_time(deadline) timeout = min(max(0, timeout), _MAX_TIMEOUT) idle_primed = None if runner.waiting_for_idle: cushion, _ = runner.waiting_for_idle.keys()[0] if cushion < timeout: timeout = cushion idle_primed = IdlePrimedTypes.WAITING_FOR_IDLE # We use 'elif' here because if there are tasks in # wait_all_tasks_blocked, then those tasks will wake up without # jumping the clock, so we don't need to autojump. elif runner.clock_autojump_threshold < timeout: timeout = runner.clock_autojump_threshold idle_primed = IdlePrimedTypes.AUTOJUMP_CLOCK if "before_io_wait" in runner.instruments: runner.instruments.call("before_io_wait", timeout) # Driver will call io_manager.get_events(timeout) and pass it back # in through the yield events = yield timeout runner.io_manager.process_events(events) if "after_io_wait" in runner.instruments: runner.instruments.call("after_io_wait", timeout) # Process cancellations due to deadline expiry now = runner.clock.current_time() if runner.deadlines.expire(now): idle_primed = None # idle_primed != None means: if the IO wait hit the timeout, and # still nothing is happening, then we should start waking up # wait_all_tasks_blocked tasks or autojump the clock. But there # are some subtleties in defining "nothing is happening". # # 'not runner.runq' means that no tasks are currently runnable. # 'not events' means that the last IO wait call hit its full # timeout. These are very similar, and if idle_primed != None and # we're running in regular mode then they always go together. But, # in *guest* mode, they can happen independently, even when # idle_primed=True: # # - runner.runq=empty and events=True: the host loop adjusted a # deadline and that forced an IO wakeup before the timeout expired, # even though no actual tasks were scheduled. # # - runner.runq=nonempty and events=False: the IO wait hit its # timeout, but then some code in the host thread rescheduled a task # before we got here. # # So we need to check both. if idle_primed is not None and not runner.runq and not events: if idle_primed is IdlePrimedTypes.WAITING_FOR_IDLE: while runner.waiting_for_idle: key, task = runner.waiting_for_idle.peekitem(0) if key[0] == cushion: del runner.waiting_for_idle[key] runner.reschedule(task) else: break else: assert idle_primed is IdlePrimedTypes.AUTOJUMP_CLOCK runner.clock._autojump() # Process all runnable tasks, but only the ones that are already # runnable now. Anything that becomes runnable during this cycle # needs to wait until the next pass. This avoids various # starvation issues by ensuring that there's never an unbounded # delay between successive checks for I/O. # # Also, we randomize the order of each batch to avoid assumptions # about scheduling order sneaking in. In the long run, I suspect # we'll either (a) use strict FIFO ordering and document that for # predictability/determinism, or (b) implement a more # sophisticated scheduler (e.g. some variant of fair queueing), # for better behavior under load. For now, this is the worst of # both worlds - but it keeps our options open. (If we do decide to # go all in on deterministic scheduling, then there are other # things that will probably need to change too, like the deadlines # tie-breaker and the non-deterministic ordering of # task._notify_queues.) batch = list(runner.runq) runner.runq.clear() if _ALLOW_DETERMINISTIC_SCHEDULING: # We're running under Hypothesis, and pytest-trio has patched # this in to make the scheduler deterministic and avoid flaky # tests. It's not worth the (small) performance cost in normal # operation, since we'll shuffle the list and _r is only # seeded for tests. batch.sort(key=lambda t: t._counter) _r.shuffle(batch) else: # 50% chance of reversing the batch, this way each task # can appear before/after any other task. if _r.random() < 0.5: batch.reverse() while batch: task = batch.pop() GLOBAL_RUN_CONTEXT.task = task if "before_task_step" in runner.instruments: runner.instruments.call("before_task_step", task) next_send_fn = task._next_send_fn next_send = task._next_send task._next_send_fn = task._next_send = None final_outcome = None try: # We used to unwrap the Outcome object here and send/throw # its contents in directly, but it turns out that .throw() # is buggy, at least on CPython 3.6: # https://bugs.python.org/issue29587 # https://bugs.python.org/issue29590 # So now we send in the Outcome object and unwrap it on the # other side. msg = task.context.run(next_send_fn, next_send) except StopIteration as stop_iteration: final_outcome = Value(stop_iteration.value) except BaseException as task_exc: # Store for later, removing uninteresting top frames: 1 # frame we always remove, because it's this function # catching it, and then in addition we remove however many # more Context.run adds. tb = task_exc.__traceback__.tb_next for _ in range(CONTEXT_RUN_TB_FRAMES): tb = tb.tb_next final_outcome = Error(task_exc.with_traceback(tb)) # Remove local refs so that e.g. cancelled coroutine locals # are not kept alive by this frame until another exception # comes along. del tb if final_outcome is not None: # We can't call this directly inside the except: blocks # above, because then the exceptions end up attaching # themselves to other exceptions as __context__ in # unwanted ways. runner.task_exited(task, final_outcome) # final_outcome may contain a traceback ref. It's not as # crucial compared to the above, but this will allow more # prompt release of resources in coroutine locals. final_outcome = None else: task._schedule_points += 1 if msg is CancelShieldedCheckpoint: runner.reschedule(task) elif type(msg) is WaitTaskRescheduled: task._cancel_points += 1 task._abort_func = msg.abort_func # KI is "outside" all cancel scopes, so check for it # before checking for regular cancellation: if runner.ki_pending and task is runner.main_task: task._attempt_delivery_of_pending_ki() task._attempt_delivery_of_any_pending_cancel() elif type(msg) is PermanentlyDetachCoroutineObject: # Pretend the task just exited with the given outcome runner.task_exited(task, msg.final_outcome) else: exc = TypeError( "trio.run received unrecognized yield message {!r}. " "Are you trying to use a library written for some " "other framework like asyncio? That won't work " "without some kind of compatibility shim.".format(msg) ) # The foreign library probably doesn't adhere to our # protocol of unwrapping whatever outcome gets sent in. # Instead, we'll arrange to throw `exc` in directly, # which works for at least asyncio and curio. runner.reschedule(task, exc) task._next_send_fn = task.coro.throw # prevent long-lived reference # TODO: develop test for this deletion del msg if "after_task_step" in runner.instruments: runner.instruments.call("after_task_step", task) del GLOBAL_RUN_CONTEXT.task # prevent long-lived references # TODO: develop test for these deletions del task, next_send, next_send_fn except GeneratorExit: # The run-loop generator has been garbage collected without finishing warnings.warn( RuntimeWarning( "Trio guest run got abandoned without properly finishing... " "weird stuff might happen" ) ) except TrioInternalError: raise except BaseException as exc: > raise TrioInternalError("internal error in Trio - please file a bug!") from exc E trio.TrioInternalError: internal error in Trio - please file a bug! __tracebackhide__ = True args = () async_fn = functools.partial(._bootstrap_fixtures_and_run_test at 0xf45dbec8>, server=) batch = [" at 0xf4577758>] events = [] final_outcome = Error(RuntimeError('cannot reuse already awaited coroutine')) host_uses_signal_set_wakeup_fd = False idle_primed = None next_send = Value(None) next_send_fn = now = 785686.1127152985 runner = Runner(clock=SystemClock(offset=126687.6110713156), instruments={'_all': {}}, io_manager=EpollIOManager(_epoll=, _registered=defaultdict(, {17: EpollWaiters(read_task=' at 0xf4577488>, write_task=None, current_flags=1)}), _force_wakeup=, _force_wakeup_fd=15), ki_manager=KIManager(handler=None), _locals={}, runq=deque([" at 0xf4577708>]), tasks={' at 0xf4577488>, ' at 0xf45776b8>, " at 0xf4577708>, " at 0xf4577758>, ._bootstrap_fixtures_and_run_test' at 0xf45777f8>}, deadlines=Deadlines(_heap=[], _active=0), init_task=' at 0xf45776b8>, system_nursery=, system_context=, main_task=._bootstrap_fixtures_and_run_test' at 0xf45777f8>, main_task_outcome=None, entry_queue=EntryQueue(queue=deque([]), idempotent_queue={}, wakeup=, done=False, lock=), trio_token=None, asyncgens=AsyncGenerators(alive={, }, trailing_needs_finalize=set(), prev_hooks=asyncgen_hooks(firstiter=None, finalizer=None)), clock_autojump_threshold=inf, is_guest=False, guest_tick_scheduled=False, ki_pending=False, waiting_for_idle=SortedDict({})) task = " at 0xf45773e8> timeout = 0 /usr/lib/python3.8/site-packages/trio/_core/_run.py:2244: TrioInternalError ___________________________________________________________________ test_error_collection ____________________________________________________________________ testdir = def test_error_collection(testdir): # We want to make sure that pytest ultimately reports all the different # exceptions. We call .upper() on all the exceptions so that we have # tokens to look for in the output corresponding to each exception, where # those tokens don't appear at all the source (so we can't get a false # positive due to pytest printing out the source file). # We sleep at the beginning of all the fixtures b/c currently if any # fixture crashes, we skip setting up unrelated fixtures whose setup # hasn't even started yet. Maybe we shouldn't? But for now the sleeps make # sure that all the fixtures have started before any of them start # crashing. testdir.makepyfile( """ import pytest from pytest_trio import trio_fixture import trio from async_generator import async_generator, yield_ test_started = False @trio_fixture async def crash_nongen(): await trio.sleep(2) raise RuntimeError("crash_nongen".upper()) @trio_fixture @async_generator async def crash_early_agen(): await trio.sleep(2) raise RuntimeError("crash_early_agen".upper()) await yield_() @trio_fixture @async_generator async def crash_late_agen(): await yield_() raise RuntimeError("crash_late_agen".upper()) async def crash(when, token): with trio.CancelScope(shield=True): await trio.sleep(when) raise RuntimeError(token.upper()) @trio_fixture def crash_background(nursery): nursery.start_soon(crash, 1, "crash_background_early") nursery.start_soon(crash, 3, "crash_background_late") @pytest.mark.trio async def test_all_the_crashes( autojump_clock, crash_nongen, crash_early_agen, crash_late_agen, crash_background, ): global test_started test_started = True def test_followup(): assert not test_started """ ) result = testdir.runpytest() > result.assert_outcomes(passed=1, failed=1) E AssertionError: assert {'errors': 1,\n 'failed': 0,\n 'passed': 1,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} == {'errors': 0,\n 'failed': 1,\n 'passed': 1,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} E Common items: E {'passed': 1, 'skipped': 0, 'xfailed': 0, 'xpassed': 0} E Differing items: E {'errors': 1} != {'errors': 0} E {'failed': 0} != {'failed': 1} E Full diff: E { E - 'errors': 0, E ? ^ E + 'errors': 1, E ? ^ E - 'failed': 1, E ? ^ E + 'failed': 0, E ? ^ E 'passed': 1, E 'skipped': 0, E 'xfailed': 0, E 'xpassed': 0, E } result = testdir = /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0/pytest_trio/_tests/test_fixture_ordering.py:198: AssertionError -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- ==================================================================== test session starts ===================================================================== platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/pytest-of-portage/pytest-0/test_error_collection0 plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1 collected 2 items test_error_collection.py E. [100%] =========================================================================== ERRORS =========================================================================== ___________________________________________________________ ERROR at setup of test_all_the_crashes ___________________________________________________________ def current_time(): """Returns the current time according to Trio's internal clock. Returns: float: The current time. Raises: RuntimeError: if not inside a call to :func:`trio.run`. """ locals()[LOCALS_KEY_KI_PROTECTION_ENABLED] = True try: > return GLOBAL_RUN_CONTEXT.runner.current_time() E AttributeError: 'RunContext' object has no attribute 'runner' /usr/lib/python3.8/site-packages/trio/_core/_generated_run.py:53: AttributeError During handling of the above exception, another exception occurred: @trio_fixture async def crash_nongen(): > await trio.sleep(2) test_error_collection.py:10: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/trio/_timeouts.py:76: in sleep await sleep_until(trio.current_time() + seconds) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ def current_time(): """Returns the current time according to Trio's internal clock. Returns: float: The current time. Raises: RuntimeError: if not inside a call to :func:`trio.run`. """ locals()[LOCALS_KEY_KI_PROTECTION_ENABLED] = True try: return GLOBAL_RUN_CONTEXT.runner.current_time() except AttributeError: > raise RuntimeError("must be called from async context") E RuntimeError: must be called from async context /usr/lib/python3.8/site-packages/trio/_core/_generated_run.py:55: RuntimeError ================================================================== short test summary info =================================================================== ERROR test_error_collection.py::test_all_the_crashes - RuntimeError: must be called from async context ================================================================= 1 passed, 1 error in 0.11s ================================================================= _________________________________________________________ test_single_yield_fixture_with_async_deps __________________________________________________________ testdir = def test_single_yield_fixture_with_async_deps(testdir): testdir.makepyfile( """ import pytest import trio events = [] @pytest.fixture async def fix0(): events.append('fix0 setup') await trio.sleep(0) return 'fix0' @pytest.fixture def fix1(fix0): events.append('fix1 setup') yield 'fix1 - ' + fix0 events.append('fix1 teardown') def test_before(): assert not events @pytest.mark.trio async def test_actual_test(fix1): assert events == ['fix0 setup', 'fix1 setup'] assert fix1 == 'fix1 - fix0' def test_after(): assert events == [ 'fix0 setup', 'fix1 setup', 'fix1 teardown', ] """ ) result = testdir.runpytest() > result.assert_outcomes(passed=3) E AssertionError: assert {'errors': 1,\n 'failed': 1,\n 'passed': 1,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} == {'errors': 0,\n 'failed': 0,\n 'passed': 3,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} E Common items: E {'skipped': 0, 'xfailed': 0, 'xpassed': 0} E Differing items: E {'errors': 1} != {'errors': 0} E {'passed': 1} != {'passed': 3} E {'failed': 1} != {'failed': 0} E Full diff: E { E - 'errors': 0, E ? ^ E + 'errors': 1, E ? ^ E - 'failed': 0, E ? ^ E + 'failed': 1, E ? ^ E - 'passed': 3, E ? ^ E + 'passed': 1, E ? ^ E 'skipped': 0, E 'xfailed': 0, E 'xpassed': 0, E } result = testdir = /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0/pytest_trio/_tests/test_sync_fixture.py:89: AssertionError -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- ==================================================================== test session starts ===================================================================== platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/pytest-of-portage/pytest-0/test_single_yield_fixture_with_async_deps0 plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1 collected 3 items test_single_yield_fixture_with_async_deps.py .EF [100%] =========================================================================== ERRORS =========================================================================== _____________________________________________________________ ERROR at setup of test_actual_test _____________________________________________________________ @pytest.fixture async def fix0(): events.append('fix0 setup') > await trio.sleep(0) test_single_yield_fixture_with_async_deps.py:9: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/trio/_timeouts.py:74: in sleep await trio.lowlevel.checkpoint() /usr/lib/python3.8/site-packages/trio/_core/_run.py:2332: in checkpoint await cancel_shielded_checkpoint() /usr/lib/python3.8/site-packages/trio/_core/_traps.py:43: in cancel_shielded_checkpoint return (await _async_yield(CancelShieldedCheckpoint)).unwrap() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ obj = @types.coroutine def _async_yield(obj): > return (yield obj) E RuntimeError: Task got bad yield: /usr/lib/python3.8/site-packages/trio/_core/_traps.py:21: RuntimeError ========================================================================== FAILURES ========================================================================== _________________________________________________________________________ test_after _________________________________________________________________________ def test_after(): > assert events == [ 'fix0 setup', 'fix1 setup', 'fix1 teardown', ] E AssertionError: assert ['fix0 setup'] == ['fix0 setup'...ix1 teardown'] E Right contains 2 more items, first extra item: 'fix1 setup' E Use -v to get the full diff test_single_yield_fixture_with_async_deps.py:27: AssertionError ================================================================== short test summary info =================================================================== FAILED test_single_yield_fixture_with_async_deps.py::test_after - AssertionError: assert ['fix0 setup'] == ['fix0 setup'...ix1 teardown'] ERROR test_single_yield_fixture_with_async_deps.py::test_actual_test - RuntimeError: Task got bad yield: ============================================================ 1 failed, 1 passed, 1 error in 0.26s ============================================================ _______________________________________________ test_sync_yield_fixture_crashed_teardown_allow_other_teardowns _______________________________________________ testdir = def test_sync_yield_fixture_crashed_teardown_allow_other_teardowns(testdir): testdir.makepyfile( """ import pytest import trio setup_events = set() teardown_events = set() @pytest.fixture async def force_async_fixture(): pass @pytest.fixture def good_fixture(force_async_fixture): setup_events.add('good_fixture setup') yield teardown_events.add('good_fixture teardown') @pytest.fixture def bad_fixture(force_async_fixture): setup_events.add('bad_fixture setup') yield teardown_events.add('bad_fixture teardown') raise RuntimeError('Crash during fixture teardown') def test_before(): assert not setup_events assert not teardown_events @pytest.mark.trio async def test_actual_test(bad_fixture, good_fixture): pass def test_after(): assert setup_events == { 'good_fixture setup', 'bad_fixture setup', } assert teardown_events == { 'bad_fixture teardown', 'good_fixture teardown', } """ ) result = testdir.runpytest() > result.assert_outcomes(failed=1, passed=2) E AssertionError: assert {'errors': 1,\n 'failed': 0,\n 'passed': 3,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} == {'errors': 0,\n 'failed': 1,\n 'passed': 2,\n 'skipped': 0,\n 'xfailed': 0,\n 'xpassed': 0} E Common items: E {'skipped': 0, 'xfailed': 0, 'xpassed': 0} E Differing items: E {'errors': 1} != {'errors': 0} E {'passed': 3} != {'passed': 2} E {'failed': 0} != {'failed': 1} E Full diff: E { E - 'errors': 0, E ? ^ E + 'errors': 1, E ? ^ E - 'failed': 1, E ? ^ E + 'failed': 0, E ? ^ E - 'passed': 2, E ? ^ E + 'passed': 3, E ? ^ E 'skipped': 0, E 'xfailed': 0, E 'xpassed': 0, E } result = testdir = /var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0/pytest_trio/_tests/test_sync_fixture.py:141: AssertionError -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- ==================================================================== test session starts ===================================================================== platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 rootdir: /var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/pytest-of-portage/pytest-0/test_sync_yield_fixture_crashed_teardown_allow_other_teardowns0 plugins: trio-0.7.0, hypothesis-6.14.1, pkgcore-0.12.1, asyncio-0.15.1 collected 3 items test_sync_yield_fixture_crashed_teardown_allow_other_teardowns.py ..E. [100%] =========================================================================== ERRORS =========================================================================== ___________________________________________________________ ERROR at teardown of test_actual_test ____________________________________________________________ force_async_fixture = None @pytest.fixture def bad_fixture(force_async_fixture): setup_events.add('bad_fixture setup') yield teardown_events.add('bad_fixture teardown') > raise RuntimeError('Crash during fixture teardown') E RuntimeError: Crash during fixture teardown test_sync_yield_fixture_crashed_teardown_allow_other_teardowns.py:22: RuntimeError ================================================================== short test summary info =================================================================== ERROR test_sync_yield_fixture_crashed_teardown_allow_other_teardowns.py::test_actual_test - RuntimeError: Crash during fixture teardown ================================================================= 3 passed, 1 error in 0.13s ================================================================= ====================================================================== warnings summary ====================================================================== pytest_trio/_tests/test_fixture_ordering.py::test_error_collection /usr/lib/python3.8/site-packages/_pytest/unraisableexception.py:78: PytestUnraisableExceptionWarning: Exception ignored in: Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/trio/_core/_run.py", line 1055, in __del__ assert not self._children AssertionError warnings.warn(pytest.PytestUnraisableExceptionWarning(msg)) -- Docs: https://docs.pytest.org/en/stable/warnings.html ================================================================== short test summary info =================================================================== XFAIL pytest_trio/_tests/test_basic.py::test_sync_function_with_trio_mark Raises pytest internal error so far... XPASS pytest_trio/_tests/test_async_fixture.py::test_raise_in_async_fixture_cause_pytest_error Not implemented yet FAILED pytest_trio/_tests/test_async_fixture.py::test_single_async_fixture - AssertionError: assert {'errors': 1,\n 'failed': 0,\n 'passed': 0,\n 'skipped'... FAILED pytest_trio/_tests/test_async_fixture.py::test_async_fixture_recomputed_for_each_test - AssertionError: assert {'errors': 2,\n 'failed': 0,\n 'passe... FAILED pytest_trio/_tests/test_async_fixture.py::test_nested_async_fixture - AssertionError: assert {'errors': 2,\n 'failed': 0,\n 'passed': 0,\n 'skipped'... FAILED pytest_trio/_tests/test_async_fixture.py::test_async_within_sync_fixture - AssertionError: assert {'errors': 1,\n 'failed': 0,\n 'passed': 0,\n 'ski... FAILED pytest_trio/_tests/test_async_yield_fixture.py::test_single_async_yield_fixture[Python>=36] - AssertionError: assert {'errors': 1,\n 'failed': 1,\n ... FAILED pytest_trio/_tests/test_async_yield_fixture.py::test_nested_async_yield_fixture[Python>=36] - AssertionError: assert {'errors': 1,\n 'failed': 1,\n ... FAILED pytest_trio/_tests/test_async_yield_fixture.py::test_async_yield_fixture_within_sync_fixture[Python>=36] - AssertionError: assert {'errors': 1,\n 'f... FAILED pytest_trio/_tests/test_async_yield_fixture.py::test_async_yield_fixture_within_sync_yield_fixture[Python>=36] - AssertionError: assert {'errors': 1... FAILED pytest_trio/_tests/test_async_yield_fixture.py::test_async_yield_fixture_with_multiple_yields[Python>=36] - AssertionError: assert {'errors': 1,\n '... FAILED pytest_trio/_tests/test_async_yield_fixture.py::test_async_yield_fixture_with_nursery[Python>=36] - AssertionError: assert {'errors': 1,\n 'failed':... FAILED pytest_trio/_tests/test_async_yield_fixture.py::test_async_yield_fixture_crashed_teardown_allow_other_teardowns[Python>=36] - AssertionError: assert... FAILED pytest_trio/_tests/test_basic.py::test_async_test_as_class_method - AssertionError: assert {'errors': 1,\n 'failed': 1,\n 'passed': 0,\n 'skipped': ... FAILED pytest_trio/_tests/test_fixture_mistakes.py::test_trio_fixture_with_wrong_scope_without_trio_mode - Failed: nomatch: '*: Trio fixtures must be funct... FAILED pytest_trio/_tests/test_fixture_mistakes.py::test_trio_fixture_with_wrong_scope_in_trio_mode[enable_trio_mode_via_pytest_ini] - Failed: nomatch: '*:... FAILED pytest_trio/_tests/test_fixture_mistakes.py::test_trio_fixture_with_wrong_scope_in_trio_mode[enable_trio_mode_trio_run_via_pytest_ini] - Failed: nom... FAILED pytest_trio/_tests/test_fixture_mistakes.py::test_trio_fixture_with_wrong_scope_in_trio_mode[enable_trio_mode_via_conftest_py] - Failed: nomatch: '*... FAILED pytest_trio/_tests/test_fixture_mistakes.py::test_async_fixture_with_sync_test_in_trio_mode[enable_trio_mode_via_pytest_ini] - AssertionError: asser... FAILED pytest_trio/_tests/test_fixture_mistakes.py::test_async_fixture_with_sync_test_in_trio_mode[enable_trio_mode_trio_run_via_pytest_ini] - AssertionErr... FAILED pytest_trio/_tests/test_fixture_mistakes.py::test_async_fixture_with_sync_test_in_trio_mode[enable_trio_mode_via_conftest_py] - AssertionError: asse... FAILED pytest_trio/_tests/test_fixture_nursery.py::test_try - trio.TrioInternalError: internal error in Trio - please file a bug! FAILED pytest_trio/_tests/test_fixture_ordering.py::test_error_collection - AssertionError: assert {'errors': 1,\n 'failed': 0,\n 'passed': 1,\n 'skipped':... FAILED pytest_trio/_tests/test_sync_fixture.py::test_single_yield_fixture_with_async_deps - AssertionError: assert {'errors': 1,\n 'failed': 1,\n 'passed':... FAILED pytest_trio/_tests/test_sync_fixture.py::test_sync_yield_fixture_crashed_teardown_allow_other_teardowns - AssertionError: assert {'errors': 1,\n 'fa... ============================================== 23 failed, 41 passed, 1 xfailed, 1 xpassed, 1 warning in 31.77s =============================================== * ERROR: dev-python/pytest-trio-0.7.0::gentoo failed (test phase): * pytest failed with python3.8 * * Call stack: * ebuild.sh, line 127: Called src_test * environment, line 2897: Called distutils-r1_src_test * environment, line 1220: Called _distutils-r1_run_foreach_impl 'python_test' * environment, line 462: Called python_foreach_impl 'distutils-r1_run_phase' 'python_test' * environment, line 2542: Called multibuild_foreach_variant '_python_multibuild_wrapper' 'distutils-r1_run_phase' 'python_test' * environment, line 2060: Called _multibuild_run '_python_multibuild_wrapper' 'distutils-r1_run_phase' 'python_test' * environment, line 2058: Called _python_multibuild_wrapper 'distutils-r1_run_phase' 'python_test' * environment, line 776: Called distutils-r1_run_phase 'python_test' * environment, line 1159: Called python_test * environment, line 2838: Called distutils-r1_python_test * environment, line 1116: Called epytest * environment, line 1578: Called die * The specific snippet of code: * "${@}" || die -n "pytest failed with ${EPYTHON}"; * * If you need support, post the output of `emerge --info '=dev-python/pytest-trio-0.7.0::gentoo'`, * the complete build log and the output of `emerge -pqv '=dev-python/pytest-trio-0.7.0::gentoo'`. * The complete build log is located at '/var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/build.log'. * The ebuild environment file is located at '/var/tmp/portage/dev-python/pytest-trio-0.7.0/temp/environment'. * Working directory: '/var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0' * S: '/var/tmp/portage/dev-python/pytest-trio-0.7.0/work/pytest-trio-0.7.0'