Skip to content

Instantly share code, notes, and snippets.

@binhngoc17
Created September 22, 2014 10:54
Show Gist options
  • Save binhngoc17/fd5dee3984ab81b04465 to your computer and use it in GitHub Desktop.
Save binhngoc17/fd5dee3984ab81b04465 to your computer and use it in GitHub Desktop.
Hack to Nosetest
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