parent
							
								
									0931fe2c89
								
							
						
					
					
						commit
						d1c725078a
					
				|  | @ -1,7 +1,8 @@ | |||
| 3.0.7 (unreleased) | ||||
| ======================= | ||||
| 
 | ||||
| * | ||||
| * Fix regression, pytest now skips unittest correctly if run with ``--pdb`` | ||||
|   (`#2137`_). Thanks to `@gst`_ for the report and `@mbyt`_ for the PR. | ||||
| 
 | ||||
| * | ||||
| 
 | ||||
|  | @ -9,6 +10,10 @@ | |||
| 
 | ||||
| * | ||||
| 
 | ||||
| .. _@gst: https://github.com/gst | ||||
| 
 | ||||
| .. _#2137: https://github.com/pytest-dev/pytest/issues/2137 | ||||
| 
 | ||||
| 
 | ||||
| 3.0.6 (2017-01-22) | ||||
| ================== | ||||
|  |  | |||
|  | @ -65,7 +65,6 @@ class UnitTestCase(pytest.Class): | |||
|                     yield TestCaseFunction('runTest', parent=self) | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| class TestCaseFunction(pytest.Function): | ||||
|     _excinfo = None | ||||
| 
 | ||||
|  | @ -157,9 +156,20 @@ class TestCaseFunction(pytest.Function): | |||
|             self._testcase(result=self) | ||||
|         else: | ||||
|             # disables tearDown and cleanups for post mortem debugging (see #1890) | ||||
|             # but still implements the skipping machinery (see #2137) | ||||
|             testMethod = getattr(self._testcase, self._testcase._testMethodName) | ||||
|             if (getattr(self._testcase.__class__, "__unittest_skip__", False) or | ||||
|                 getattr(testMethod, "__unittest_skip__", False)): | ||||
|                 # If the class or method was skipped. | ||||
|                 skip_why = (getattr(self._testcase.__class__, '__unittest_skip_why__', '') | ||||
|                             or getattr(testMethod, '__unittest_skip_why__', '')) | ||||
|                 try: | ||||
|                     self._testcase._addSkip(self, self._testcase, skip_why) | ||||
|                 except TypeError:  # PY2 | ||||
|                     self._testcase._addSkip(self, skip_why) | ||||
|                 return | ||||
|             self._testcase.debug() | ||||
| 
 | ||||
| 
 | ||||
|     def _prunetraceback(self, excinfo): | ||||
|         pytest.Function._prunetraceback(self, excinfo) | ||||
|         traceback = excinfo.traceback.filter( | ||||
|  |  | |||
|  | @ -106,6 +106,20 @@ class TestPDB: | |||
|         assert 'debug.me' in rest | ||||
|         self.flush(child) | ||||
| 
 | ||||
|     def test_pdb_unittest_skip(self, testdir): | ||||
|         p1 = testdir.makepyfile(""" | ||||
|             import unittest | ||||
|             @unittest.skipIf(True, 'Skipping also with pdb active') | ||||
|             class MyTestCase(unittest.TestCase): | ||||
|                 def test_one(self): | ||||
|                     assert 0 | ||||
|         """) | ||||
|         child = testdir.spawn_pytest("-rs --pdb %s" % p1) | ||||
|         child.expect('Skipping also with pdb active') | ||||
|         child.expect('1 skipped in') | ||||
|         child.sendeof() | ||||
|         self.flush(child) | ||||
| 
 | ||||
|     def test_pdb_interaction_capture(self, testdir): | ||||
|         p1 = testdir.makepyfile(""" | ||||
|             def test_1(): | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue