Created
September 22, 2014 10:54
-
-
Save binhngoc17/fd5dee3984ab81b04465 to your computer and use it in GitHub Desktop.
Hack to Nosetest
This file contains hidden or 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 | |
class SampleTestCase(unittest.TestCase): | |
def __init__(self, *args, **kwargs): | |
self.account_id = kwargs['account_id'] | |
del kwargs['account_id'] | |
super(SampleTestCase, self).__init__(*args, **kwargs) | |
def test_a(self): | |
print 'test a' + str(self.account_id) | |
def test_b(self): | |
print 'test a' + str(self.account_id) | |
def test_c(self): | |
print 'test a' + str(self.account_id) | |
def create_suites(): | |
suite = unittest.TestSuite() | |
suite.addTest(SampleTestCase('test_a', account_id=1)) | |
suite.addTest(SampleTestCase('test_b', account_id=1)) | |
suite.addTest(SampleTestCase('test_c', account_id=1)) | |
return suite | |
suites = create_suites() | |
unittest.TextTestRunner(verbosity=2).run(suites) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment