How to use the unittest2.TestSuite function in unittest2

To help you get started, we’ve selected a few unittest2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gorakhargosh / mom / tools / unused / run_tests.py View on Github external
def get_suite(tests):
    tests = sorted(tests)
    suite = unittest.TestSuite()
    loader = unittest.TestLoader()
    for test in tests:
        suite.addTest(loader.loadTestsFromName(test))
    return suite
github bluedynamics / cone.app / src / cone / app / tests.py View on Github external
def test_suite():
    XMLConfig('testing/dummy_workflow.zcml', cone.app.tests)()
    suite = unittest.TestSuite()
    suite.addTests([
        layered(
            doctest.DocFileSuite(
                testfile,
                globs={'interact': interlude.interact,
                       'pprint': pprint.pprint,
                       'pp': pprint.pprint,
                       },
                optionflags=optionflags,
                ),
            layer=layer,
            )
        for testfile in TESTFILES
        ])
    return suite
github inveniosoftware / invenio / invenio / testsuite / __init__.py View on Github external
def make_test_suite(*test_cases):
    """Build up a test suite given separate test cases."""
    return unittest.TestSuite([unittest.makeSuite(case, 'test')
                               for case in test_cases])
github benselme / flask-mako / tests / test_mako.py View on Github external
def suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(MakoTestCase))
    suite.addTest(unittest.makeSuite(MakoMultipleDirectoriesTestCase))
    suite.addTest(unittest.makeSuite(MakoDetailedTestCase))
    if MakoBabelTestCase:
        suite.addTest(unittest.makeSuite(MakoBabelTestCase))
    return suite
github giampaolo / psutil / test / test_psutil.py View on Github external
def main():
    tests = []
    test_suite = unittest.TestSuite()
    tests.append(TestSystemAPIs)
    tests.append(TestProcess)
    tests.append(TestFetchAllProcesses)
    tests.append(TestMisc)
    tests.append(TestExampleScripts)
    tests.append(LimitedUserTestCase)
    tests.append(TestUnicode)
    tests.append(TestNonUnicode)

    if POSIX:
        from _posix import PosixSpecificTestCase
        tests.append(PosixSpecificTestCase)

    # import the specific platform test suite
    stc = None
    if LINUX:
github irods / irods / scripts / run_tests.py View on Github external
def filter_testcase(suite, marker):
        return fnmatch.fnmatch(suite.id(), marker)

    def filter_testsuite(suite):
        if isinstance(suite, unittest.TestCase):
            if len(d["filtered_markers"]) == 0:
                d["filtered_markers"] = filter(lambda marker: filter_testcase(suite, marker[0]), markers)
            if len(d["filtered_markers"]) != 0:
                suitelist.append(suite)
                d["filtered_markers"] = filter(lambda marker: marker[-1] == "" or not filter_testcase(suite, marker[-1]), d["filtered_markers"])
        else:
            for subsuite in suite:
                filter_testsuite(subsuite)

    filter_testsuite(suites)
    super_suite = unittest.TestSuite(suitelist)

    if xml_output:
        import xmlrunner
        runner = xmlrunner.XMLTestRunner(output='test-reports', verbosity=2)
    else:
        runner = unittest.TextTestRunner(verbosity=2, failfast=True, buffer=buffer_test_output, resultclass=RegisteredTestResult)
    results = runner.run(super_suite)
    return results
github microsoft / PowerShell-DSC-for-Linux / Providers / Scripts / 3.x / Scripts / Tests / test_nxProviders.py View on Github external
self.assertTrue(nxExec.Set('export JOJO=mam ; echo $JOJO | grep mama','JOJO"=MAMA',True,0,0,'','','echo $JOJO | grep MAMA') ==
                        [-1],"self.assertTrue(nxExec.Set('export JOJO=mam ; echo $JOJO | grep mama','JOJO=MAMA',True,0,30,'','','echo $JOJO | grep MAMA') should == [-1]")

    
######################################
if __name__ == '__main__':
    s1=unittest2.TestLoader().loadTestsFromTestCase(LinuxUserTestCases)
    s2=unittest2.TestLoader().loadTestsFromTestCase(LinuxGroupTestCases)
    s3=unittest2.TestLoader().loadTestsFromTestCase(LinuxFileTestCases)
    s4=unittest2.TestLoader().loadTestsFromTestCase(LinuxScriptTestCases)
    s5=unittest2.TestLoader().loadTestsFromTestCase(LinuxServiceTestCases)
    s6=unittest2.TestLoader().loadTestsFromTestCase(LinuxPackageTestCases)
    s7=unittest2.TestLoader().loadTestsFromTestCase(LinuxSshAuthorizedKeysTestCases)
    s8=unittest2.TestLoader().loadTestsFromTestCase(LinuxEnvironmentTestCases)
    s9=unittest2.TestLoader().loadTestsFromTestCase(LinuxExecTestCases)
    alltests = unittest2.TestSuite([s1,s2,s3,s4,s7,s8,s9,s5,s6,s7,s8,s9])
    unittest2.TextTestRunner(verbosity=3).run(alltests)
github collective / collective.lineage / src / collective / lineage / tests.py View on Github external
def test_suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(IntegrationTests))
    suite.addTest(unittest.makeSuite(MigrationTests))
    return suite
github microsoft / PowerShell-DSC-for-Linux / Providers / Scripts / 2.4x-2.5x / Scripts / Tests / test_nxOMSAutomationWorker.py View on Github external
def test_kill_any_worker_running_as_omsagent(self):
        proc = subprocess.Popen(["sudo", "-u", "omsagent", "python", nxOMSAutomationWorker.WORKER_MANAGER_START_PATH])
        ret_code = proc.poll()
        # make sure process is running
        self.assertTrue(ret_code is None)
        nxOMSAutomationWorker.kill_any_worker_running_as_omsagent(nxOMSAutomationWorker.WORKER_MANAGER_START_PATH)
        time.sleep(3)
        ret_code = proc.poll()
        # make sure process was terminated
        self.assertTrue(ret_code == 0)


if __name__ == '__main__':
    s1 = unittest2.TestLoader().loadTestsFromTestCase(nxOMSAutomationWorkerTestCases)
    all_tests = unittest2.TestSuite([s1])
    unittest2.TextTestRunner(stream=sys.stdout, verbosity=3).run(all_tests)
github disqus / mule / mule / contrib / django / suite.py View on Github external
def build_suite(self, test_labels, extra_tests=None, **kwargs):
            # XXX: We shouldn't need to hook this if Mule can handle the shortname.TestCase format
            suite = unittest2.TestSuite()

            if test_labels:
                for label in test_labels:
                    if '.' in label:
                        suite.addTest(get_test_by_name(label, self.loader))
                    else:
                        app = get_app(label)
                        suite.addTest(build_suite(app))
            else:
                for app in get_apps():
                    suite.addTest(build_suite(app))

            if extra_tests:
                for test in extra_tests:
                    suite.addTest(test)