diff --git a/CHANGELOG.rst b/CHANGELOG.rst index dbd3fd9..e4b8953 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,7 @@ to install a newer ``mock`` version from PyPI instead of using the one available in the Python distribution. Thanks `@wcooley`_ for the PR (`#54`_). +* ``mock.sentinel`` is now aliased as ``mocker.sentinel`` for convenience. .. _@wcooley: https://github.com/wcooley .. _#54: https://github.com/pytest-dev/pytest-mock/issues/54 diff --git a/README.rst b/README.rst index 4e1dc3b..2477c11 100644 --- a/README.rst +++ b/README.rst @@ -69,6 +69,7 @@ Some objects from the ``mock`` module are accessible directly from ``mocker`` fo * `PropertyMock `_ * `ANY `_ * `call `_ *(Version 1.1)* +* `sentinel `_ *(Version 1.2)* Spy diff --git a/pytest_mock.py b/pytest_mock.py index 6e9d011..8088432 100644 --- a/pytest_mock.py +++ b/pytest_mock.py @@ -21,6 +21,7 @@ class MockFixture(object): PropertyMock = mock_module.PropertyMock call = mock_module.call ANY = mock_module.ANY + sentinel = mock_module.sentinel def __init__(self): self._patches = [] # list of mock._patch objects diff --git a/test_pytest_mock.py b/test_pytest_mock.py index c999cd3..1e47d0e 100644 --- a/test_pytest_mock.py +++ b/test_pytest_mock.py @@ -132,7 +132,7 @@ def test_deprecated_mock(mock, tmpdir): assert os.listdir(str(tmpdir)) == [] -@pytest.mark.parametrize('name', ['MagicMock', 'PropertyMock', 'Mock', 'call', 'ANY']) +@pytest.mark.parametrize('name', ['MagicMock', 'PropertyMock', 'Mock', 'call', 'ANY', 'sentinel']) def test_mocker_aliases(name): from pytest_mock import mock_module, MockFixture