Unittest - Bring back diag() for generating TAP output

* Still needs work to make sure output is displayed after the test
status (not ok ...) and not before.
This commit is contained in:
Renato Alves 2014-07-14 11:37:35 +01:00
parent 75fe62149d
commit d354d13263
10 changed files with 32 additions and 16 deletions

View file

@ -2,5 +2,6 @@
from .task import Task
from .taskd import Taskd
from .testing import TestCase
# vim: ai sts=4 et sw=4

15
test/basetest/testing.py Normal file
View file

@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
import unittest
import sys
class TestCase(unittest.TestCase):
def diag(self, out):
sys.stdout.write("# --- diag start ---\n")
for line in out.split("\n"):
sys.stdout.write("#" + line + "\n")
sys.stdout.write("# --- diag end ---\n")
# vim: ai sts=4 et sw=4

View file

@ -33,10 +33,10 @@ import unittest
# Ensure python finds the local simpletap and basetest modules
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from basetest import Task
from basetest import Task, TestCase
class TestBug1254(unittest.TestCase):
class TestBug1254(TestCase):
def setUp(self):
self.t = Task()

View file

@ -32,10 +32,10 @@ import unittest
# Ensure python finds the local simpletap and basetest modules
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from basetest import Task
from basetest import Task, TestCase
class TestBug1267(unittest.TestCase):
class TestBug1267(TestCase):
def setUp(self):
self.t = Task()

View file

@ -33,10 +33,10 @@ import unittest
# Ensure python finds the local simpletap and basetest modules
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from basetest import Task
from basetest import Task, TestCase
class BaseTestBug360(unittest.TestCase):
class BaseTestBug360(TestCase):
def setUp(self):
"""Executed before each test in the class"""
self.t = Task()

View file

@ -8,10 +8,10 @@ from datetime import datetime
# Ensure python finds the local simpletap module
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from basetest import Task, Taskd
from basetest import Task, Taskd, TestCase
class TestCase(unittest.TestCase):
class TestBugNumber(TestCase):
@classmethod
def setUpClass(cls):
"""Executed once before any test in the class"""

View file

@ -32,10 +32,10 @@ import unittest
# Ensure python finds the local simpletap and basetest modules
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from basetest import Task
from basetest import Task, TestCase
class TestBug1300(unittest.TestCase):
class TestBug1300(TestCase):
@classmethod
def setUp(cls):
cls.t = Task()

View file

@ -31,10 +31,10 @@ import os
import unittest
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from basetest import Task
from basetest import Task, TestCase
class TestBug1306(unittest.TestCase):
class TestBug1306(TestCase):
def setUp(self):
self.t = Task()

View file

@ -32,10 +32,10 @@ import unittest
# Ensure python finds the local simpletap and basetest modules
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from basetest import Task
from basetest import Task, TestCase
class Test285(unittest.TestCase):
class Test285(TestCase):
@classmethod
def setUpClass(cls):
cls.t = Task()

View file

@ -33,10 +33,10 @@ from datetime import datetime
# Ensure python finds the local simpletap module
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from basetest import Task
from basetest import Task, TestCase
class TestVersion(unittest.TestCase):
class TestVersion(TestCase):
def setUp(self):
self.t = Task()