diff options
author | Daniel Hahler <git@thequod.de> | 2019-05-28 01:46:16 +0200 |
---|---|---|
committer | Daniel Hahler <git@thequod.de> | 2019-05-28 01:46:16 +0200 |
commit | e03290441361c219ec939f4bff3342978f06ae92 (patch) | |
tree | 3f8bc7f242186b71626f5a4e23afe6556420c64f /testing/test_pdb.py | |
parent | 2b9ca342809a4e05b4451a074d644c14acda844c (diff) | |
parent | ece774f0eb0bb87aa37c8c34df13a18be1500bfb (diff) | |
download | pytest-e03290441361c219ec939f4bff3342978f06ae92.tar.gz |
Merge master into features
Diffstat (limited to 'testing/test_pdb.py')
-rw-r--r-- | testing/test_pdb.py | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/testing/test_pdb.py b/testing/test_pdb.py index bdb7be940..8c4534109 100644 --- a/testing/test_pdb.py +++ b/testing/test_pdb.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function @@ -744,7 +745,8 @@ class TestPDB(object): ["E NameError: *xxx*", "*! *Exit: Quitting debugger !*"] # due to EOF ) - def test_enter_leave_pdb_hooks_are_called(self, testdir): + @pytest.mark.parametrize("post_mortem", (False, True)) + def test_enter_leave_pdb_hooks_are_called(self, post_mortem, testdir): testdir.makeconftest( """ mypdb = None @@ -773,16 +775,25 @@ class TestPDB(object): """ import pytest - def test_foo(): + def test_set_trace(): pytest.set_trace() assert 0 + + def test_post_mortem(): + assert 0 """ ) - child = testdir.spawn_pytest(str(p1)) + if post_mortem: + child = testdir.spawn_pytest(str(p1) + " --pdb -s -k test_post_mortem") + else: + child = testdir.spawn_pytest(str(p1) + " -k test_set_trace") child.expect("enter_pdb_hook") child.sendline("c") - child.expect(r"PDB continue \(IO-capturing resumed\)") - child.expect("Captured stdout call") + if post_mortem: + child.expect(r"PDB continue") + else: + child.expect(r"PDB continue \(IO-capturing resumed\)") + child.expect("Captured stdout call") rest = child.read().decode("utf8") assert "leave_pdb_hook" in rest assert "1 failed" in rest @@ -1150,12 +1161,13 @@ def test_pdbcls_via_local_module(testdir): result = testdir.runpytest( str(p1), "--pdbcls=really.invalid:Value", syspathinsert=True ) - result.stderr.fnmatch_lines( + result.stdout.fnmatch_lines( [ - "ERROR: --pdbcls: could not import 'really.invalid:Value': No module named *really*" + "*= FAILURES =*", + "E * --pdbcls: could not import 'really.invalid:Value': No module named *really*", ] ) - assert result.ret == 4 + assert result.ret == 1 result = testdir.runpytest( str(p1), "--pdbcls=mypdb:Wrapped.MyPdb", syspathinsert=True |