Skip to content

'FixtureDef' object has no attribute 'unittest' (an Async @ 8.2.0 issue?) #12270

@wxtim

Description

@wxtim

8.2.0 has broken the cylc-flow unit tests with the following error:

: _________________________________________ ERROR at setup of test_false_if_not_running _________________________________________
[gw0] linux -- Python 3.9.19 /home/tim/micromamba/envs/cylc.2/bin/python

event_loop = <_UnixSelectorEventLoop running=False closed=False debug=False>
request = <SubRequest 'sim_time_check_setup' for <Function test_false_if_not_running>>
kwargs = {'mod_flow': functools.partial(<function _make_flow at 0x7f77c5be2700>, PosixPath('/home/tim/cylc-run'), PosixPath('/h...s>.__make_scheduler at 0x7f77c5b373a0>, 'mod_start': functools.partial(<function _start_flow at 0x7f77c5be2940>, None)}

    @functools.wraps(fixture)
    def _asyncgen_fixture_wrapper(
        event_loop: asyncio.AbstractEventLoop, request: SubRequest, **kwargs: Any
    ):
        func = _perhaps_rebind_fixture_func(
>           fixture, request.instance, fixturedef.unittest
        )
E       AttributeError: 'FixtureDef' object has no attribute 'unittest'

../../../.local/lib/python3.9/site-packages/pytest_asyncio/plugin.py:275: AttributeError

Looks similar to #12263, although my project doesn't use Tornado, but asyncio. I'm investigating further, but would appreciate thoughts on this.

  • a detailed description of the bug or problem you are having
- [ ] output of `pip list` from the virtual environment you are using Package Version Editable project location --------------------- ---------- ------------------------------------ aiofiles 0.7.0 aiosmtpd 1.4.5 aniso8601 7.0.0 ansimarkup 1.5.0 astor 0.8.1 async-generator 1.10 async-timeout 4.0.2 atpublic 4.1.0 attrs 23.1.0 bandit 1.7.5 certifi 2024.2.2 charset-normalizer 3.3.2 classify-imports 4.2.0 click 8.1.7 colorama 0.4.4 contourpy 1.0.7 coverage 7.2.5 cycler 0.11.0 cylc-flow 8.3.0.dev0 /home/tim/tims_code/metomi/cylc-flow empy 3.3.4 exceptiongroup 1.1.1 execnet 1.9.0 flake8 7.0.0 flake8-broken-line 1.0.0 flake8-bugbear 23.3.12 flake8-builtins 2.1.0 flake8-comprehensions 3.12.0 flake8-debugger 4.1.2 flake8-mutable 1.2.0 flake8_simplify 0.20.0 flake8-type-checking 2.9.0 fonttools 4.39.4 gitdb 4.0.10 GitPython 3.1.31 graphene 2.1.9 graphql-core 2.3.2 graphql-relay 2.0.1 greenlet 1.1.2 idna 3.7 importlib_metadata 7.1.0 importlib-resources 5.12.0 incremental 22.10.0 iniconfig 2.0.0 Jinja2 3.0.3 kiwisolver 1.4.4 ldap3 2.9.1 markdown-it-py 2.2.0 MarkupSafe 2.0.1 matplotlib 3.7.1 mccabe 0.7.0 mdurl 0.1.2 metomi-isodatetime 1!3.0.0 mypy 1.3.0 mypy-extensions 1.0.0 numpy 1.24.3 packaging 23.1 pandas 1.5.3 pbr 5.11.1 Pillow 9.5.0 pip 24.0 pluggy 1.5.0 promise 2.3 protobuf 4.24.4 psutil 5.9.0 pyasn1 0.4.8 pycodestyle 2.11.1 pyflakes 3.2.0 Pygments 2.15.1 Pympler 1.0.1 pyparsing 3.0.9 pytest 8.2.0 pytest-asyncio 0.21.0 pytest-cov 4.0.0 pytest-env 0.8.1 pytest-mock 3.10.0 pytest-xdist 3.2.1 python-dateutil 2.8.2 pytz 2023.3 pyuv 1.4.0 PyYAML 6.0 pyzmq 26.0.2 requests 2.31.0 rich 13.3.5 Rx 1.6.1 setuptools 69.5.1 six 1.16.0 smmap 5.0.0 SQLAlchemy 1.4.31 sqlparse 0.4.4 stevedore 5.0.0 testfixtures 7.1.0 tomli 2.0.1 towncrier 23.11.0 types-Jinja2 2.11.9 types-MarkupSafe 1.1.10 types-pkg-resources 0.1.3 types-protobuf 4.23.0.1 types-six 1.16.21.8 typing_extensions 4.5.0 urllib3 2.2.1 urwid 2.6.11 wcwidth 0.2.13 wheel 0.43.0 zipp 3.15.0
  • pytest and operating system versions
  • minimal example if possible
import pytest

@pytest.fixture
async def myfixture():
    yield 1

def test_noddy(myfixture):
    assert 1 == myfixture

I think this issue may have been introduced at #12096

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