python - Nose not executes setUpClass when run suite -
have cases.py file defined test suite:
def tests(): setup = { 'full': ( clients.testclients, ) } cases = os.getenv('testrun', 'full') all_tests = () case in setup[cases]: all_tests = itertools.chain(all_tests, testloader().loadtestsfromtestcase(case)) suite = lazysuite(all_tests) nose.run(suite=suite) also have class defined methods , class(like template) user:
class admin(maintemplate): @classmethod def setupclass(cls): cls.login(cls.autotest_admin, cls.default_password) @classmethod def teardownclass(cls): cls.logout() and file tests:
class testclients(admin): def test_one(self): print(1) if manually(from ide) run class, setupclass executed if run cases.py file, setupclass not executed
what's wrong?
upd: i've understood same thing, testloader().loadtestsfromtestcase(case) load test_ functions, not file setupclass method, true story?
how can programmatically emulate running whole file (like ide) ?
Comments
Post a Comment