PY-18926: Wrapping AttributeError

Nose has bug: instead of Test we are getting ContextSuite in case of error in setup class. It does not have attribute .test, so we wrap it try / except to mimic previous behavior (pre 5.0) when we simply did not check this field
This commit is contained in:
Ilya.Kazakevich
2016-03-24 23:11:50 +03:00
parent fe36270236
commit 8bb39694b4
3 changed files with 14 additions and 4 deletions
+4 -1
View File
@@ -55,7 +55,10 @@ class TeamcityPlugin(ErrorClassPlugin, TextTestResult, TeamcityTestResult):
def _is_failure(self, test):
return isinstance(test.test, Failure)
try:
return isinstance(test.test, Failure)
except AttributeError:
return False
def addError(self, test, err):
exctype, value, tb = err
+9 -1
View File
@@ -1,4 +1,4 @@
#from unittest import TestCase
from unittest import TestCase
class TestNose:
def testOne(self):
@@ -9,3 +9,11 @@ class TestNose:
def testThree():
assert 4 == 2*2
class FooTest(TestCase):
@classmethod
def setUpClass(self):
raise ValueError() # or any other bug
def test_test(self):
pass
@@ -36,9 +36,8 @@ public final class PythonNoseTestingTest extends PyEnvTestCase {
@NotNull final String stdout,
@NotNull final String stderr,
@NotNull final String all) {
assertEquals(3, runner.getAllTestsCount());
assertEquals(4, runner.getAllTestsCount());
assertEquals(3, runner.getPassedTestsCount());
runner.assertAllTestsPassed();
}
});
}