How to use the unittest2.TestLoader 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 quattor / aquilon / tests / broker / test_bind_client.py View on Github external
(out, err) = self.successtest(command)
        self.matchoutput(err,
                         "unittest00.one-nyp.ms.com adding binding for "
                         "service ntp instance pa.ny.na",
                         command)

    def testverifybindautontp(self):
        command = "show host --hostname unittest00.one-nyp.ms.com"
        out = self.commandtest(command.split(" "))
        self.matchoutput(out,
                         "Uses Service: ntp Instance: pa.ny.na",
                         command)


if __name__ == '__main__':
    suite = unittest.TestLoader().loadTestsFromTestCase(TestBindClient)
    unittest.TextTestRunner(verbosity=2).run(suite)
github quattor / aquilon / tests / broker / test_add_dns_domain.py View on Github external
def testaddlocaldomain(self):
        hostname = self.config.get('unittest', 'hostname')
        (name, dot, domain) = hostname.partition('.')
        # If the local host is under .ms.com, then we don't want to add it again
        (p, out, err) = self.runcommand(["show", "dns", "domain",
                                         "--dns_domain", domain])
        if domain and p.returncode == 4:
            self.dsdb_expect("add_dns_domain -domain_name %s -comments " % domain)
            command = ["add", "dns", "domain", "--dns_domain", domain]
            self.noouttest(command)
            self.dsdb_verify()


if __name__ == '__main__':
    suite = unittest.TestLoader().loadTestsFromTestCase(TestAddDnsDomain)
    unittest.TextTestRunner(verbosity=2).run(suite)
github quattor / aquilon / tests / broker / test_map_dns_domain.py View on Github external
self.noouttest(command)

    def test_450_verify_positions(self):
        command = ["search", "dns", "domain", "map", "--room", "utroom1"]
        out = self.commandtest(command)
        self.searchoutput(out,
                          r"DNS Domain: td1.aqd-unittest.ms.com Map: Room utroom1\s*"
                          r"Position: 0\s*"
                          r"DNS Domain: td2.aqd-unittest.ms.com Map: Room utroom1\s*"
                          r"Position: 1\s*"
                          r"DNS Domain: aqd-unittest.ms.com Map: Room utroom1\s*"
                          r"Position: 2\s*",
                          command)

if __name__ == '__main__':
    suite = unittest.TestLoader().loadTestsFromTestCase(TestMapDnsDomain)
    unittest.TextTestRunner(verbosity=2).run(suite)
github quattor / aquilon / tests / broker / test_search_esx_cluster.py View on Github external
out = self.notfoundtest(command)
        self.matchoutput(out, "Rack rack-does-not-exist not found",
                         command)

    def testbuildstatuspos(self):
        command = ['search_esx_cluster', '--buildstatus=build']
        out = self.commandtest(command)
        self.matchoutput(out, "utecl4", command)

    def testbuildstatusneg(self):
        command = ['search_esx_cluster', '--buildstatus=decommissioned']
        self.noouttest(command)


if __name__ == '__main__':
    suite = unittest.TestLoader().loadTestsFromTestCase(TestSearchESXCluster)
    unittest.TextTestRunner(verbosity=2).run(suite)
github quattor / aquilon / tests / broker / test_add_allowed_personality.py View on Github external
"--personality=metacluster",
                          "--cluster", "utmc1"])

    def test_20_checkconstraint(self):
        command = ["show_cluster", "--cluster=utecl1"]
        out = self.commandtest(command)
        self.matchoutput(out, "Allowed Personality: Personality vmhost/vulcan-1g-desktop-prod", command)
        self.matchoutput(out, "Allowed Personality: Personality vmhost/generic", command)

        command = ["show_cluster", "--cluster=utmc1"]
        out = self.commandtest(command)
        self.matchoutput(out, "Allowed Personality: Personality metacluster/metacluster", command)


if __name__ == '__main__':
    suite = unittest.TestLoader().loadTestsFromTestCase(TestAddAllowedPersonality)
    unittest.TextTestRunner(verbosity=2).run(suite)
github intel / intelRSD / VTS / sources / run_tests.py View on Github external
import unittest2 as unittest
import unit_tests

if __name__ == "__main__":
    all_tests = unittest.TestLoader().loadTestsFromModule(unit_tests)
    unittest.TextTestRunner(verbosity=2).run(all_tests)
github datasift / datasift-python / tests / test_client.py View on Github external
self.assertEqual(result.status_code, 200)
                assert_dict_structure(self, result, expected_output)
            self.assertNotEqual(runs, 0, "ensure that at least one case was tested")

if __name__ == '__main__':
    suite = unittest.TestLoader().loadTestsFromTestCase(TestMockedClient)
    #unittest.TextTestRunner(verbosity=2).run(suite)
    suite = unittest.TestLoader().loadTestsFromTestCase(TestMockedHistoricsClient)
    #unittest.TextTestRunner(verbosity=2).run(suite)
    suite = unittest.TestLoader().loadTestsFromTestCase(TestMockedManagedSourcesClient)
    #unittest.TextTestRunner(verbosity=2).run(suite)
    suite = unittest.TestLoader().loadTestsFromTestCase(TestMockedPushClient)
    #unittest.TextTestRunner(verbosity=2).run(suite)
    suite = unittest.TestLoader().loadTestsFromTestCase(TestMockedPylonClient)
    #unittest.TextTestRunner(verbosity=2).run(suite)
    suite = unittest.TestLoader().loadTestsFromTestCase(TestMockedIdentityClient)
    #unittest.TextTestRunner(verbosity=2).run(suite)
    suite = unittest.TestLoader().loadTestsFromTestCase(TestMockedIdentityTokenClient)
    #unittest.TextTestRunner(verbosity=2).run(suite)
    suite = unittest.TestLoader().loadTestsFromTestCase(TestMockedIdentityLimitClient)
    #unittest.TextTestRunner(verbosity=2).run(suite)
    suite = unittest.TestLoader().loadTestsFromTestCase(TestMockedOdpClient)
    #unittest.TextTestRunner(verbosity=2).run(suite)
    suite = unittest.TestLoader().loadTestsFromTestCase(TestMockedAccountClient)
    #unittest.TextTestRunner(verbosity=2).run(suite)
    suite = unittest.TestLoader().loadTestsFromTestCase(TestAsyncClient)
    #unittest.TextTestRunner(verbosity=2).run(suite)
    suite = unittest.TestLoader().loadTestsFromTestCase(TestMockedTaskClient)
    unittest.TextTestRunner(verbosity=2).run(suite)
github inpho / vsm / unit_tests / tests_beagleenvironment.py View on Github external
from tempfile import NamedTemporaryFile
        import os

        try:
            tmp = NamedTemporaryFile(delete=False, suffix='.npz')
            self.m.save(tmp.name)
            tmp.close()
            m1 = BeagleEnvironment.load(tmp.name)
            self.assertTrue((self.m.matrix == m1.matrix).all())
    
        finally:
            os.remove(tmp.name)
       
        
#Define and run test suite
suite = unittest.TestLoader().loadTestsFromTestCase(TestBeagleEnvironment)
unittest.TextTestRunner(verbosity=2).run(suite)
github grnet / synnefo / test / config.py View on Github external
def run_test_case(test_case):
    """
    Runs the test_case and returns the result
    """
    # Again from snf-tools/synnefo_tools/burnin.py
    # Thank you John Giannelos 
    printf("Running {0}", test_case)
    import sys
    suite = unittest.TestLoader().loadTestsFromTestCase(test_case)
    runner = unittest.TextTestRunner(stream=sys.stderr, verbosity=2,
                                     failfast=True, buffer=False)
    return runner.run(suite)
github sciserver / SciScript-Python / Tests / UnitTests.py View on Github external
relativePath = jobDirectory.split('scratch/')[1] + Jobs_QueryResultsFile + '.csv';
        string = Files.download(fileService, 'scratch', '',relativePath,format="txt", userVolumeOwner=Authentication_loginName);
        string.rstrip("\n")
        self.assertTrue(string, Jobs_SqlQueryResult)


    def test_Jobs_getJobDirectory(self):
        #TBD
        pass;




if __name__ == '__main__':
    #unittest.main()
    unittest.TestLoader.sortTestMethodsUsing = lambda x, y: cmp(x,y);
    testLoader = unittest.TestLoader()
    testLoader.sortTestMethodsUsing = lambda x, y: 0;
    suite = testLoader.loadTestsFromTestCase(TestAuthentication); unittest.TextTestRunner(verbosity=2).run(suite)
    suite = testLoader.loadTestsFromTestCase(TestLoginPortal); unittest.TextTestRunner(verbosity=2).run(suite)
    suite = testLoader.loadTestsFromTestCase(TestCasJobs); unittest.TextTestRunner(verbosity=2).run(suite)
    suite = testLoader.loadTestsFromTestCase(TestSkyServer); unittest.TextTestRunner(verbosity=2).run(suite)
    suite = testLoader.loadTestsFromTestCase(TestSciDrive); unittest.TextTestRunner(verbosity=2).run(suite)
    suite = testLoader.loadTestsFromTestCase(TestSkyQuery); unittest.TextTestRunner(verbosity=2).run(suite)
    suite = testLoader.loadTestsFromTestCase(TestFileService); unittest.TextTestRunner(verbosity=2).run(suite)
    suite = testLoader.loadTestsFromTestCase(TestJobs); unittest.TextTestRunner(verbosity=2).run(suite)