Last active
June 2, 2019 04:00
-
-
Save guerbai/0b013991ce831407adb0a1853d085255 to your computer and use it in GitHub Desktop.
python测试代码组织
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
# 1situation. | |
def emailsuite(): | |
suite = unittest.TestSuite() | |
tests = [ | |
'test_normal_sendemail', | |
'test_no_dealnocb_work' | |
] | |
return unittest.TestSuite(map(testemail.EmailTestCase, tests)) | |
# 2situation. | |
def emailsuite(): | |
suite = unittest.TestSuite() | |
suite.addTest(testemail.EmailTestCase('test_normal_send_email')) | |
suite.addTest(testemail.EmailTestCase('test_no_dealnocb_work')) | |
return suite | |
# 2situation client. | |
suite1 = emailsuite() | |
alltests = unittest.TestSuite([suite1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment