adding corresponding test, authors and changelog

This commit is contained in:
mbyt 2016-08-31 20:22:54 +02:00
parent 4eeb475138
commit 10b3274924
3 changed files with 27 additions and 0 deletions

View File

@ -91,6 +91,7 @@ Martin Prusse
Matt Bachmann Matt Bachmann
Matt Williams Matt Williams
Matthias Hafner Matthias Hafner
mbyt
Michael Aquilina Michael Aquilina
Michael Birtwell Michael Birtwell
Michael Droettboom Michael Droettboom

View File

@ -12,13 +12,20 @@
* Fix ``UnicodeEncodeError`` when string comparison with unicode has failed. (`#1864`_) * Fix ``UnicodeEncodeError`` when string comparison with unicode has failed. (`#1864`_)
Thanks `@AiOO`_ for the PR Thanks `@AiOO`_ for the PR
* Do not call tearDown (and cleanups) when running unittest with ``--pdb``
enabled. This allows proper post mortem debugging for all applications
which have significant logic in their tearDown method (`#1890`_). Thanks
`@mbyt`_ for the PR.
* *
.. _@joguSD: https://github.com/joguSD .. _@joguSD: https://github.com/joguSD
.. _@AiOO: https://github.com/AiOO .. _@AiOO: https://github.com/AiOO
.. _@mbyt: https://github.com/mbyt
.. _#1857: https://github.com/pytest-dev/pytest/issues/1857 .. _#1857: https://github.com/pytest-dev/pytest/issues/1857
.. _#1864: https://github.com/pytest-dev/pytest/issues/1864 .. _#1864: https://github.com/pytest-dev/pytest/issues/1864
.. _#1890: https://github.com/pytest-dev/pytest/issues/1890
3.0.1 3.0.1

View File

@ -79,6 +79,25 @@ class TestPDB:
if child.isalive(): if child.isalive():
child.wait() child.wait()
def test_pdb_unittest_postmortem(self, testdir):
p1 = testdir.makepyfile("""
import unittest
class Blub(unittest.TestCase):
def tearDown(self):
self.filename = None
def test_false(self):
self.filename = 'bla' + '.txt'
assert 0
""")
child = testdir.spawn_pytest("--pdb %s" % p1)
child.expect('(Pdb)')
child.sendline('p self.filename')
child.sendeof()
rest = child.read().decode("utf8")
assert 'bla.txt' in rest
if child.isalive():
child.wait()
def test_pdb_interaction_capture(self, testdir): def test_pdb_interaction_capture(self, testdir):
p1 = testdir.makepyfile(""" p1 = testdir.makepyfile("""
def test_1(): def test_1():