|
| 1 | +# pylint: disable=redefined-outer-name |
| 2 | +# pylint: disable=unused-argument |
| 3 | +# pylint: disable=unused-variable |
| 4 | + |
| 5 | +import asyncio |
| 6 | + |
| 7 | +import pytest |
| 8 | +import pytest_asyncio |
| 9 | + |
| 10 | +pytest_simcore_core_services_selection = [ |
| 11 | + "migration", |
| 12 | + "postgres", |
| 13 | +] |
| 14 | +pytest_simcore_ops_services_selection = [] |
| 15 | + |
| 16 | + |
| 17 | +@pytest.fixture(autouse=True) |
| 18 | +def _drop_and_recreate_postgres(database_from_template_before_each_function: None): |
| 19 | + return |
| 20 | + |
| 21 | + |
| 22 | +@pytest.fixture |
| 23 | +def some_fixture( |
| 24 | + event_loop: asyncio.AbstractEventLoop, |
| 25 | + simcore_services_ready: None, |
| 26 | +): |
| 27 | + event_loop.run_until_complete(asyncio.sleep(0.1)) |
| 28 | + |
| 29 | + |
| 30 | +# NOTE: Remove skip marker to check whether `pytest-asyncio<0.23` constraint in _test.in |
| 31 | +@pytest.mark.skip(reason="Checks pytest-asyncio upgrade issue") |
| 32 | +async def test_pytest_asyncio_known_issue(some_fixture: None): |
| 33 | + # |
| 34 | + # This test demonstrates a common failure in most integration tests when using pytest-asyncio version 0.23. |
| 35 | + # The test was derived by simplifying the original test_garbage_collection.py to highlight the issue. |
| 36 | + # |
| 37 | + # Due to an unresolved issue in pytest-asyncio, pytest will fail to execute this async test, |
| 38 | + # resulting in the following error: |
| 39 | + # |
| 40 | + # `RuntimeError: There is no current event loop in thread 'MainThread'.` |
| 41 | + # |
| 42 | + # For more details, refer to the "Known Issues" section in the release notes: |
| 43 | + # https://github.com/pytest-dev/pytest-asyncio/releases/tag/v0.23.8 |
| 44 | + # |
| 45 | + |
| 46 | + assert pytest_asyncio.__version__ |
| 47 | + |
| 48 | + # NOTE: it might fail upon db tear-down but it is not relevant for this test |
0 commit comments