Last change
on this file since 1403 was 1394, checked in by wouter, 5 days ago |
#428 change way exceptions are parsed. Added test for that.
|
File size:
786 bytes
|
Rev | Line | |
---|
[1394] | 1 | import sys
|
---|
| 2 | from typing import List
|
---|
| 3 | from unittest.case import TestCase
|
---|
| 4 | from unitpy.Test import Test
|
---|
| 5 | from unitpy.RunWith import RunWith
|
---|
| 6 | from unitpy.Runner import JUnit4ClassRunner
|
---|
| 7 | from unitpy.Runner import runTests
|
---|
| 8 |
|
---|
| 9 | def g():
|
---|
| 10 | raise AttributeError("g")
|
---|
| 11 |
|
---|
| 12 |
|
---|
| 13 | @RunWith(JUnit4ClassRunner)
|
---|
| 14 | class 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 |
|
---|
| 39 | class Test(TestCase):
|
---|
| 40 | def test(self):
|
---|
| 41 | runTests(FailingTest)
|
---|
| 42 | |
---|
Note:
See
TracBrowser
for help on using the repository browser.