Skip to content

Commit

Permalink
Merge pull request #143 from ikonst/no_terminal
Browse files Browse the repository at this point in the history
Support terminal plugin being disabled
  • Loading branch information
nicoddemus committed Apr 17, 2019
2 parents d9d785e + 7248438 commit 92418e3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
1.10.4
------

* Fix plugin when 'terminal' plugin is disabled

1.10.3
------

Expand Down
2 changes: 1 addition & 1 deletion pytest_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def parse_ini_boolean(value):


def pytest_configure(config):
tb = config.getoption("--tb")
tb = config.getoption("--tb", default="auto")
if (
parse_ini_boolean(config.getini("mock_traceback_monkeypatch"))
and tb != "native"
Expand Down
16 changes: 16 additions & 0 deletions test_pytest_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,22 @@ def test_foo(mocker):
) # make sure there are no duplicated tracebacks (#44)


def test_monkeypatch_no_terminal(testdir):
"""Don't crash without 'terminal' plugin.
"""
testdir.makepyfile(
"""
def test_foo(mocker):
stub = mocker.stub()
stub(1, greet='hello')
stub.assert_called_once_with(1, greet='hey')
"""
)
result = runpytest_subprocess(testdir, "-p", "no:terminal", "-s")
assert result.ret == 1
assert result.stdout.lines == []


@pytest.mark.skipif(sys.version_info[0] < 3, reason="Py3 only")
def test_standalone_mock(testdir):
"""Check that the "mock_use_standalone" is being used.
Expand Down

0 comments on commit 92418e3

Please sign in to comment.