Example #1
0
 def __call__(self, *args, **kwds):
     if len(args) > 0:
         result = args[0]
         if not _hasFailed(result):
             # loop count down
             self.loop = getattr(self, 'loop', _loopSuite)
             result.loopSuite = 0
             # flag to indicate if the test suite has finished its loop execution
             result.loopSuiteDone = False
             # determine if the suite consists of test cases for the same class
             suiteClass = next(iter(self), None).__class__
             className = suiteClass.__name__
             if suiteClass != None.__class__ and all(
                     isinstance(test, TangoTestCase)
                     and test.__class__ == suiteClass for test in self):
                 # print test suite name (only once), truncate the '__loop' suffix and show number of iterations
                 if self.loop == _loopSuite:
                     suiteName = formatName(className)
                     if suiteName.endswith(_loopSuffix):
                         suiteName = suiteName[:-len(_loopSuffix)]
                         if _loopSuite > 1:
                             suiteName += ' [' + str(_loopSuite) + ' iter]'
                     result.stream.writeln("\n" + suiteName + "\n")
                 # execute test suites with suffix '__loop' multiple times
                 if className.endswith(_loopSuffix) and self.loop > 1:
                     # treat test methods executed in a loop as one test run
                     testsRun = result.testsRun
                     self.loop -= 1
                     # TODO: check efficiency
                     suite = deepcopy(self)
                     suite(*args, **kwds)
                     result.testsRun = testsRun
             if not _hasFailed(result):
                 result.loopSuite += 1
                 # at the last iteration of the suite loop set the flag to True
                 if not className.endswith(
                         _loopSuffix
                 ) or _loopSuite <= 1 or result.loopSuite == _loopSuite:
                     result.loopSuiteDone = True
                 return super(TangoTestSuite, self).run(*args, **kwds)
Example #2
0
 def __call__(self, *args, **kwds):
     if len(args) > 0:
         result = args[0]
         if not _hasFailed(result):
             # loop count down
             self.loop = getattr(self,'loop', _loopSuite)
             result.loopSuite = 0
             # flag to indicate if the test suite has finished its loop execution
             result.loopSuiteDone = False
             # determine if the suite consists of test cases for the same class
             suiteClass = next(iter(self), None).__class__
             className = suiteClass.__name__
             if suiteClass != None.__class__ and all(isinstance(test, TangoTestCase) and test.__class__ == suiteClass for test in self):
                 # print test suite name (only once), truncate the '__loop' suffix and show number of iterations
                 if self.loop == _loopSuite:
                     suiteName = formatName(className)
                     if suiteName.endswith(_loopSuffix):
                         suiteName = suiteName[:-len(_loopSuffix)]
                         if _loopSuite > 1:
                             suiteName += ' [' + str(_loopSuite) + ' iter]'
                     result.stream.writeln("\n" + suiteName + "\n")
                 # execute test suites with suffix '__loop' multiple times
                 if className.endswith(_loopSuffix) and self.loop > 1:
                     # treat test methods executed in a loop as one test run
                     testsRun = result.testsRun
                     self.loop -= 1
                     # TODO: check efficiency
                     suite = deepcopy(self)
                     suite(*args, **kwds)
                     result.testsRun = testsRun
             if not _hasFailed(result):
                 result.loopSuite += 1
                 # at the last iteration of the suite loop set the flag to True
                 if not className.endswith(_loopSuffix) or _loopSuite <= 1 or result.loopSuite == _loopSuite:
                     result.loopSuiteDone = True
                 return super(TangoTestSuite, self).run(*args, **kwds)
Example #3
0
    for line in output.splitlines():
        line = line.strip()
        if line:
            if line not in result:
                msg = "\nGot: %s\nMissing: \"%s\"" % (result, line)
                break
    if msg and output_bad_pdftotext:
        warn("Standard test failed; let's try a test amended for older pdftotext versions now. If this succeeds, please consider upgrading to the latest version of pdftotext.")
        msg = ""
        for line in output_bad_pdftotext.splitlines():
            line = line.strip()
            if line:
                if line not in result:
                    msg = "\nGot: %s\nMissing: \"%s\"" % (result, line)
                    break
    if msg:
        return (False, msg)
    else:
        return (True, True)



if 'custom' in sys.argv:
    from unittest import suite
    TEST_SUITE = suite(BibClassifyRegressionTest)
else:
    TEST_SUITE = make_test_suite(BibClassifyRegressionTest)

if __name__ == "__main__":
    run_test_suite(TEST_SUITE, warn_user=True)
        line = line.strip()
        if line:
            if line not in result:
                msg = "\nGot: %s\nMissing: \"%s\"" % (result, line)
                break
    if msg and output_bad_pdftotext:
        warn(
            "Standard test failed; let's try a test amended for older pdftotext versions now. If this succeeds, please consider upgrading to the latest version of pdftotext."
        )
        msg = ""
        for line in output_bad_pdftotext.splitlines():
            line = line.strip()
            if line:
                if line not in result:
                    msg = "\nGot: %s\nMissing: \"%s\"" % (result, line)
                    break
    if msg:
        return (False, msg)
    else:
        return (True, True)


if 'custom' in sys.argv:
    from unittest import suite
    TEST_SUITE = suite(BibClassifyRegressionTest)
else:
    TEST_SUITE = make_test_suite(BibClassifyRegressionTest)

if __name__ == "__main__":
    run_test_suite(TEST_SUITE, warn_user=True)
Example #5
0
 def suite(self):
     s = unittest.suite()
     s.addTest(FHUSERTest())
import unittest
from hpeu.CRM.Login import Login
from hpeu.CRM.CreateClue import CreateClue
from hpeu.CRM.LookClue import LookClue
from hpeu.CRM.CreateCustomer import CreateCustomer
from hpeu.CRM.LookCustomer import LookCustomer
from hpeu.CRM.Createbusiness import Createbusiness
from hpeu.CRM.Lookbusiness import Lookbusiness
from hpeu.CRM.Createschedule import Createschedule
from hpeu.CRM.Lookschedule import Lookschedule
from hpeu.CRM.Createtask import Createtask
from hpeu.CRM.Looktask import Looktask

if __name__ == "__nain__":
    suite = unittest.suite()
    suite.addTest(Login("test_Login"))
    suite.addTest(CreateClue("test_CreateClue"))
    suite.addTest(LookClue("test_LookClue"))
    suite.addTest(CreateCustomer("test_CreateCustomer"))
    suite.addTest(LookCustomer("test_LookCustomer"))
    suite.addTest(Createbusiness("test_Createbusiness"))
    suite.addTest(Lookbusiness("test_Lookbusiness"))
    suite.addTest(Createschedule("test_Createschedule"))
    suite.addTest(Lookschedule("test_Lookschedule"))
    suite.addTest(Createtask("test_Createtask"))
    suite.addTest(Looktask("test_Looktask"))

    Runner = unittest.TextTestRunner()
    Runner.run(suite)