def setUp(self): super(TestJunitXmlPlugin, self).setUp() self.session = session.Session() self.loader = loader.PluggableTestLoader(self.session) self.result = result.PluggableTestResult(self.session) self.plugin = junitxml.JUnitXmlReporter(session=self.session) self.plugin.register() #unittest2 needs this if not hasattr(self, 'assertRegexp'): self.assertRegex = self.assertRegexpMatches class Test(unittest.TestCase): def test(self): pass def test_fail(self): assert False def test_err(self): 1/0 def test_skip(self): raise unittest.SkipTest('skip') def test_bad_xml(self): raise RuntimeError(TestJunitXmlPlugin.BAD_FOR_XML_U) def test_bad_xml_b(self): raise RuntimeError(TestJunitXmlPlugin.BAD_FOR_XML_B) def test_gen(self): def check(a, b): self.assertEqual(a, b) yield check, 1, 1 yield check, 1, 2 @tools.params(1, 2, 3) def test_params(self, p): self.assertEqual(p, 2) self.case = Test
def setUp(self): super(TestJunitXmlPlugin, self).setUp() self.session = session.Session() self.loader = loader.PluggableTestLoader(self.session) self.result = result.PluggableTestResult(self.session) self.plugin = junitxml.JUnitXmlReporter(session=self.session) self.plugin.register() class Test(unittest.TestCase): def test(self): pass def test_fail(self): assert False def test_err(self): 1/0 def test_skip(self): raise unittest.SkipTest('skip') def test_gen(self): def check(a, b): self.assertEqual(a, b) yield check, 1, 1 yield check, 1, 2 @tools.params(1, 2, 3) def test_params(self, p): self.assertEqual(p, 2) self.case = Test
def setUp(self): super(TestJunitXmlPlugin, self).setUp() self.session = session.Session() self.loader = loader.PluggableTestLoader(self.session) self.result = result.PluggableTestResult(self.session) self.plugin = junitxml.JUnitXmlReporter(session=self.session) self.plugin.register() # Python 2.7 needs this # assertRegexpMatches() was renamed to assertRegex() in 3.2 if not hasattr(self, 'assertRegex'): self.assertRegex = self.assertRegexpMatches class Test(unittest.TestCase): def test(self): pass def test_chdir(self): TEMP_SUBFOLDER = 'test_chdir' os.mkdir(TEMP_SUBFOLDER) os.chdir(TEMP_SUBFOLDER) def test_fail(self): assert False def test_err(self): 1 / 0 def test_skip(self): self.skipTest('skip') def test_skip_no_reason(self): self.skipTest('') def test_bad_xml(self): raise RuntimeError(TestJunitXmlPlugin.BAD_FOR_XML_U) def test_bad_xml_b(self): raise RuntimeError(TestJunitXmlPlugin.BAD_FOR_XML_B) def test_gen(self): def check(a, b): self.assertEqual(a, b) yield check, 1, 1 yield check, 1, 2 @tools.params(1, 2, 3) def test_params(self, p): self.assertEqual(p, 2) def test_with_log(self): logging.info('log message') self.case = Test
def setUp(self): super(TestJunitXmlPlugin, self).setUp() self.session = session.Session() self.loader = loader.PluggableTestLoader(self.session) self.result = result.PluggableTestResult(self.session) self.plugin = junitxml.JUnitXmlReporter(session=self.session) self.plugin.register() # Python 2.7 needs this # assertRegexpMatches() was renamed to assertRegex() in 3.2 if not hasattr(self, "assertRegex"): self.assertRegex = self.assertRegexpMatches class Test(unittest.TestCase): def test(self): pass def test_chdir(self): TEMP_SUBFOLDER = "test_chdir" os.mkdir(TEMP_SUBFOLDER) os.chdir(TEMP_SUBFOLDER) def test_fail(self): assert False def test_err(self): 1 / 0 def test_skip(self): self.skipTest("skip") def test_skip_no_reason(self): self.skipTest("") def test_bad_xml(self): raise RuntimeError(TestJunitXmlPlugin.BAD_FOR_XML_U) def test_bad_xml_b(self): raise RuntimeError(TestJunitXmlPlugin.BAD_FOR_XML_B) def test_gen(self): def check(a, b): # workaround: # for the test which ensures that the timestamp increases between # generator test runs, insert a very small sleep # # on py3.10 on Windows, we have observed both of these tests getting # the same timestamp time.sleep(0.001) self.assertEqual(a, b) yield check, 1, 1 yield check, 1, 2 @tools.params(1, 2, 3) def test_params(self, p): self.assertEqual(p, 2) def test_with_log(self): logging.info("log message") self.case = Test