Better not do this.
Tests must be independent.
To do what you need, it would be best to turn the code into functions called by the test.
Like:
def assert_can_log_in(self): ... def test_1(self): self.assert_can_log_in() ... def test_2(self): self.assert_can_log_in() ...
Or even break the test class and put the statements in the setUp function.
class LoggedInTests(unittest.TestCase): def setUp(self):
When I break up a class, I often write more and better tests, because the tests are divided, and I can better see all the tests that need to be checked.
User May 03 '13 at 17:23 2013-05-03 17:23
source share