File tree Expand file tree Collapse file tree 4 files changed +13
-5
lines changed Expand file tree Collapse file tree 4 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 18
18
if a test suite uses ``pytest_plugins `` to load internal plugins (`#1888 `_).
19
19
Thanks `@jaraco `_ for the report and `@nicoddemus `_ for the PR (`#1891 `_).
20
20
21
- * Do not call tearDown (and cleanups) when running unittest with ``--pdb ``
21
+ * Do not call tearDown and cleanups when running tests from
22
+ ``unittest.TestCase `` subclasses with ``--pdb ``
22
23
enabled. This allows proper post mortem debugging for all applications
23
- which have significant logic in their tearDown method (`#1890 `_). Thanks
24
+ which have significant logic in their tearDown machinery (`#1890 `_). Thanks
24
25
`@mbyt `_ for the PR.
25
26
26
27
*
Original file line number Diff line number Diff line change @@ -153,7 +153,7 @@ def runtest(self):
153
153
if self .config .pluginmanager .get_plugin ("pdbinvoke" ) is None :
154
154
self ._testcase (result = self )
155
155
else :
156
- # disables tearDown and cleanups for post mortem debugging
156
+ # disables tearDown and cleanups for post mortem debugging (see #1890)
157
157
self ._testcase .debug ()
158
158
159
159
Original file line number Diff line number Diff line change @@ -33,6 +33,13 @@ distributing tests to multiple CPUs via the ``-nNUM`` option if you
33
33
installed the ``pytest-xdist `` plugin. Please refer to
34
34
the general ``pytest `` documentation for many more examples.
35
35
36
+ .. note ::
37
+
38
+ Running tests from ``unittest.TestCase `` subclasses with ``--pdb `` will
39
+ disable tearDown and cleanup methods for the case that an Exception is
40
+ occurs. This allows proper post mortem debugging for all applications
41
+ which have significant logic in their tearDown machinery.
42
+
36
43
Mixing pytest fixtures into unittest.TestCase style tests
37
44
-----------------------------------------------------------
38
45
Original file line number Diff line number Diff line change @@ -86,15 +86,15 @@ class Blub(unittest.TestCase):
86
86
def tearDown(self):
87
87
self.filename = None
88
88
def test_false(self):
89
- self.filename = 'bla ' + '.txt '
89
+ self.filename = 'debug ' + '.me '
90
90
assert 0
91
91
""" )
92
92
child = testdir .spawn_pytest ("--pdb %s" % p1 )
93
93
child .expect ('(Pdb)' )
94
94
child .sendline ('p self.filename' )
95
95
child .sendeof ()
96
96
rest = child .read ().decode ("utf8" )
97
- assert 'bla.txt ' in rest
97
+ assert 'debug.me ' in rest
98
98
if child .isalive ():
99
99
child .wait ()
100
100
You can’t perform that action at this time.
0 commit comments