Skip to content

Fixture with scope=package have incorrect request object #10993

@TheoGoudout

Description

@TheoGoudout

When using a fixuture with the package scope, the request object is not of the expected type. To be accurate, the request.node is of type Session when one could expect it to be of type Package.

Versions:

  • python 3.7.16
  • pytest 7.3.1

Example:

import pytest


@pytest.fixture(scope="package")
def package_fixture(request):
    assert False, (type(request.node), request.node)

def test_fixture(package_fixture):
    pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: fixturesanything involving fixtures directly or indirectlytype: enhancementnew feature or API change, should be merged into features branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions