From 3c285665905cb03ce7df11a9e86662d7388668f7 Mon Sep 17 00:00:00 2001 From: Renato Alves Date: Sun, 16 Feb 2014 00:25:44 +0000 Subject: [PATCH] Unit tests - version.t now uses BaseTestCase --- test/version.t | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/test/version.t b/test/version.t index cbfd3335a..df4ce2386 100755 --- a/test/version.t +++ b/test/version.t @@ -31,37 +31,35 @@ import os # Ensure python finds the local simpletap module sys.path.append(os.path.dirname(os.path.abspath(__file__))) -import unittest +from basetest import BaseTestCase + from subprocess import Popen, PIPE, STDOUT from datetime import datetime -class TestVersion(unittest.TestCase): +class TestVersion(BaseTestCase): @classmethod - def setUpClass(cls): - """Executed once before any test in the class""" + def prepare(cls): # Empty rc file open("version.rc", 'w').close() def testVersion(self): """Copyright is current""" - command = ["../src/task", "rc:version.rc", "version"] + args = ["rc:version.rc", "version"] - # Merge STDOUT and STDERR - p = Popen(command, stdout=PIPE, stderr=STDOUT) - out, err = p.communicate() + code, out, err = self.callTaskSuccess(args) expected = "Copyright \(C\) \d{4} - %d" % (datetime.now().year,) self.assertRegexpMatches(out.decode("utf8"), expected) @classmethod - def tearDownClass(cls): - """Executed once after all tests in the class""" + def finish(cls): os.remove("version.rc") if __name__ == "__main__": from simpletap import TAPTestRunner + import unittest unittest.main(testRunner=TAPTestRunner()) # vim: ai sts=4 et sw=4