test_ok2/testing/example_scripts/acceptance/fixture_mock_integration.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
323 B
Python
Raw Normal View History

# mypy: allow-untyped-defs
"""Reproduces issue #3774"""
from unittest import mock
import pytest
config = {"mykey": "ORIGINAL"}
@pytest.fixture(scope="function")
@mock.patch.dict(config, {"mykey": "MOCKED"})
def my_fixture():
return config["mykey"]
def test_foobar(my_fixture):
assert my_fixture == "MOCKED"