Skip to content

Using monkeypatch in non function scoped fixture #363

Open
@pytestbot

Description

@pytestbot

Originally reported by: BitBucket: ColeVsCode, GitHub: ColeVsCode


Hi, I'd like to be able to create a module or session scoped fixture that uses monkeypatch.

#!python

    @pytest.fixture(scope='session')
    def usermanager(monkeypatch):
    ...

This raises an error. There's some comments about this on the pytest-dev list.

https://mail.python.org/pipermail/pytest-dev/2012-November/002157.html

Is there a work-around in the mean time that I can use to change the scope of the monkeypatch fixture?


Metadata

Metadata

Assignees

No one assigned

    Labels

    plugin: monkeypatchrelated to the monkeypatch builtin plugintype: 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