def test_write_plan_first_combined(self): outdir = tempfile.mkdtemp() tracker = Tracker(streaming=False, outdir=outdir, combined=True) tracker.set_plan(123) tracker.generate_tap_reports() with open(os.path.join(outdir, "testresults.tap"), "r") as f: lines = f.readlines() self.assertEqual(lines[0], "1..123\n")
def test_write_plan_first_combined(self): outdir = tempfile.mkdtemp() tracker = Tracker(streaming=False, outdir=outdir, combined=True) tracker.set_plan(123) tracker.generate_tap_reports() with open(os.path.join(outdir, "testresults.tap"), "r") as f: lines = f.readlines() self.assertEqual(lines[0], "1..123\n")
def test_write_plan_first_streaming(self): outdir = tempfile.mkdtemp() stream = StringIO() tracker = Tracker(outdir=outdir, streaming=True, stream=stream) tracker.set_plan(123) tracker.add_ok("FakeTestCase", "YESSS!") tracker.generate_tap_reports() self.assertEqual( stream.getvalue(), "1..123\n# TAP results for FakeTestCase\nok 1 YESSS!\n" ) self.assertFalse(os.path.exists(os.path.join(outdir, "FakeTestCase.tap")))
def test_write_plan_first_not_combined(self): outdir = tempfile.mkdtemp() tracker = Tracker(streaming=False, outdir=outdir, combined=False) with self.assertRaises(ValueError): tracker.set_plan(123)
def test_write_plan_first_streaming(self): stream = StringIO() tracker = Tracker(streaming=True, stream=stream) tracker.set_plan(123) tracker.generate_tap_reports() self.assertEqual(stream.getvalue(), "1..123\n")
def test_write_plan_first_not_combined(self): outdir = tempfile.mkdtemp() tracker = Tracker(streaming=False, outdir=outdir, combined=False) with self.assertRaises(ValueError): tracker.set_plan(123)
def test_write_plan_first_streaming(self): stream = StringIO() tracker = Tracker(streaming=True, stream=stream) tracker.set_plan(123) tracker.generate_tap_reports() self.assertEqual(stream.getvalue(), "1..123\n")