Skip to content

[self-tests] add support for pytest-asyncio 1.0.0+ #124

@stanislavlevin

Description

@stanislavlevin

pytest-asyncio 1.0.0

removed the deprecated event_loop fixture. (#1106)

https://pytest-asyncio.readthedocs.io/en/latest/reference/changelog.html

This leads to tests errors like:

______________________ ERROR at setup of test_login_twice ______________________
file /usr/src/RPM/BUILD/python3-module-aioimaplib-2.0.1/tests/test_imapserver_imaplib2.py, line 43
  @pytest.mark.asyncio()
  async def test_login_twice(with_server):
      with pytest.raises(imaplib2.IMAP4.error) as expected:
          imap_client = await login_user('user', 'pass', lib=imaplib2.IMAP4)

          await asyncio.wait_for(
              asyncio.get_running_loop().run_in_executor(None, functools.partial(imap_client.login, 'user', 'pass')), 1)

          assert expected == 'command LOGIN illegal in state AUTH'
file /usr/src/RPM/BUILD/python3-module-aioimaplib-2.0.1/tests/server_fixture.py, line 38
  @pytest.fixture()
  def with_server(event_loop, request):
E       fixture 'event_loop' not found
>       available fixtures: _class_scoped_runner, _function_scoped_runner, _module_scoped_runner, _package_scoped_runner, _session_scoped_runner, anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, capteesys, doctest_namespace, event_loop_policy, free_tcp_port, free_tcp_port_factory, free_udp_port, free_udp_port_factory, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory, unused_tcp_port, unused_tcp_port_factory, unused_udp_port, unused_udp_port_factory, with_server
>       use 'pytest --fixtures [testpath]' for help on them.

/usr/src/RPM/BUILD/python3-module-aioimaplib-2.0.1/tests/server_fixture.py:38

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions