source: pyrunner/failingtest/testcode/failingTest.py@ 1403

Last change on this file since 1403 was 1394, checked in by wouter, 4 days ago

#428 change way exceptions are parsed. Added test for that.

File size: 786 bytes
Line 
1import sys
2from typing import List
3from unittest.case import TestCase
4from unitpy.Test import Test
5from unitpy.RunWith import RunWith
6from unitpy.Runner import JUnit4ClassRunner
7from unitpy.Runner import runTests
8
9def g():
10 raise AttributeError("g")
11
12
13@RunWith(JUnit4ClassRunner)
14class FailingTest:
15 '''
16 has a good and two failing tests.
17 One failing test raises explicit error.
18 Another does a failing asssert.
19 '''
20
21 @Test()
22 def goodtest(self):
23 TestCase().assertEquals(1,1)
24
25
26 @Test()
27 def failedtest(self):
28 try:
29 g()
30 except Exception as e:
31 raise AssertionError("this is wrong") from e
32
33 @Test()
34 def failedtest2(self):
35 TestCase().assertEquals(0,1)
36
37
38
39class Test(TestCase):
40 def test(self):
41 runTests(FailingTest)
42
Note: See TracBrowser for help on using the repository browser.