def test_mocker_aliases(name, pytestconfig): from pytest_mock import _get_mock_module, MockFixture mock_module = _get_mock_module(pytestconfig) mocker = MockFixture(pytestconfig) assert getattr(mocker, name) is getattr(mock_module, name)
def set_default_config(pytestconfig): mocker = MockFixture(pytestconfig) mocker.patch.object(config.IniConfigMixin, 'DEFAULT_CONFIG_PATH') config.IniConfigMixin.DEFAULT_CONFIG_PATH.return_value = str( Path(__file__) / 'configs' / 'non-premium.config') yield mocker.stopall()
def mocker(pytestconfig): result = MockFixture(pytestconfig) yield result result.stopall()
def test_mocker_aliases(name): from pytest_mock import mock_module, MockFixture mocker = MockFixture() assert getattr(mocker, name) is getattr(mock_module, name)
def mocker_context(): result = MockFixture(FakePytestConfig()) yield result result.stopall()
def mocker_context(): result = MockFixture() yield result result.stopall()
def test_mocker_has_mock_class_as_attribute_for_instantiation(): from pytest_mock import mock_module, MockFixture mocker = MockFixture() assert isinstance(mocker.Mock(), mock_module.Mock)