Пример #1
0
 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")
Пример #2
0
 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")
Пример #3
0
    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")))
Пример #4
0
 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)
Пример #5
0
 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")
Пример #6
0
 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)
Пример #7
0
 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")