-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_C.py
More file actions
39 lines (28 loc) · 846 Bytes
/
Copy pathpython_C.py
File metadata and controls
39 lines (28 loc) · 846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2018-03-06 16:35:31
# @Author : Your Name (you@example.org)
# @Link : http://example.org
# @Version : $Id$
import unittest,HTMLTestRunner
class Test(unittest.TestCase):
def setUp(self):
print("<<<<<< start test >>>>>>")
self.a = 5
self.b = 11
def tearDown(self):
print("<<<<<< end test >>>>>>")
def test1(self):
print(self.a + self.b)
def test2(self):
self.assertEqual(self.a,self.b)
if __name__ == '__main__':
suit=unittest.TestSuite()
suit.addTest(Test("test1"))
suit.addTest(Test("test2"))
fp = open('./result.html','wb')
runner=HTMLTestRunner.HTMLTestRunner(stream=fp,
title=u'<test demo>test report',
description=u'describe: ... ')
runner.run(suit)
fp.close()