Skip to content

yield fixture decorated with @keyword does not get executed #362

Description

@DetachHead
from __future__ import annotations

from pytest import fixture
from robot.api import logger

from pytest_robotframework import keyword


@fixture
@keyword
def foo():
    logger.info("setup")  # doesn't get run
    yield "asdf"
    logger.info("teardown")  # doesn't get run


def test_foo(foo: str):
    logger.info(foo)  # prints <generator object foo at 0x73543ca43280> instead of "asdf"

it's not clear what decorating such a fixture as a @keyword is even supposed to do. so it should probably just be an error (ideally both a type error and a runtime error)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions