mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
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:
@@ -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
@@ -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();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user