Other answers to this question are valid to the extent that they allow you to run tests in several environments, but, playing with the options, I think I like a more independent approach. I use kits and results to organize and display test results. To run one test with two environments, not two tests, I took this approach - create a subclass of TestSuite.
class FixtureSuite(unittest.TestSuite): def run(self, result, debug=False): socket.setdefaulttimeout(30) super().run(result, debug) socket.setdefaulttimeout(None) ... suite1 = unittest.TestSuite(testCases) suite2 = FixtureSuite(testCases) fullSuite = unittest.TestSuite([suite1,suite2]) unittest.TextTestRunner(verbosity=2).run(fullSuite)
source share