예제 #1
0
def make_suites(suites: list, context: ChainMap):
    suite = TestSuite()

    for item in suites:
        # 编译数据
        parameters = compile_data(item.get('parameters', [{}]))
        variables = compile_data(item.get('variables', {}))
        request_settings = compile_data(item.get('request', {}))

        # 参数化处理
        for parameter in parameters(context):
            # 创建子上下文
            child_context = context.new_child(parameter)

            # 将变量合并到子上下文中
            child_context.update(variables(child_context))

            # 创建 http 客户端
            client = HttpClient(**request_settings(child_context))

            # 添加集合
            suite.addTest(
                make_suite(item, context=child_context, client=client))

    return suite
def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(VolumeServerIntegration(
        "test_can_create_volume_server_from_deactivated_image"))
    suite.addTest(VolumeServerIntegration(
        "test_can_create_volume_server_from_reactivated_image"))
    return suite
def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(DeactivateReactivateBlockStorage(
        'test_create_volume_from_deactivated_image_invalid'))
    suite.addTest(DeactivateReactivateBlockStorage(
        'test_create_volume_from_reactivated_image'))
    return suite
예제 #4
0
def load_tests_from_classes(test_cases):
    suite = TestSuite()
    loader = TestLoader()
    for test_class in test_cases:
        tests = loader.loadTestsFromTestCase(test_class)
        suite.addTests(tests)
    return suite
예제 #5
0
def load_tests(loader, tests, pattern):
    suite = TestSuite()
    suite.addTests(load_testsuite(loader, dirname(__file__)))
    # Numba CUDA tests are located in a separate directory:
    cuda_dir = join(dirname(dirname(__file__)), 'cuda/tests')
    suite.addTests(loader.discover(cuda_dir))
    return suite
예제 #6
0
def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(GlanceScrubberTest(
        "test_chunks_present_after_image_create"))
    suite.addTest(GlanceScrubberTest(
        "test_chunks_deleted_after_image_delete"))
    return suite
예제 #7
0
파일: test_util.py 프로젝트: orenlivne/ober
def load_tests_from_classes(test_cases):
    suite = TestSuite()
    loader = TestLoader()
    for test_class in test_cases:
        tests = loader.loadTestsFromTestCase(test_class)
        suite.addTests(tests)
    return suite
def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(MultipleContainersTest(
        "test_custom_container_present_after_image_create"))
    suite.addTest(MultipleContainersTest(
        "test_custom_container_present_after_image_delete"))
    return suite
def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(CreateServerVolumeIntegrationTest(
        "test_attach_volume_to_server"))
    suite.addTest(CreateServerVolumeIntegrationTest(
        "test_format_and_mount_volume"))
    return suite
예제 #10
0
def suite():
    suite = TestSuite()
    suite.addTest(SimpleKindAwareInsertTest())
    suite.addTest(KindAwareInsertWithParentTest())
    suite.addTest(SimpleKindAwareQueryTest())
    suite.addTest(AncestorQueryTest())
    return suite
예제 #11
0
 def load_tests(loader: TestLoader, standard_tests: TestSuite,
                pattern: Optional[str]) -> TestSuite:
     ret = TestSuite((standard_tests, ))
     for cls in tests:
         suite = loader.loadTestsFromTestCase(cls)
         ret.addTests(suite)
     return ret
def load_tests(loader, standard_tests, pattern):
    """
    Generate a test suite of tests from several test classes.

    Specifically:
        - test_volume_attached_after_migration from
            LiveMigratateServerWithVolumeTests
        - test_format_and_mount_disks, test_live_migrate_server,
          test_verify_ephemeral_disks_mounted from
          LiveMigratateServerWithVolumeTests

    These tests are added in a specific order to the load_tests method to
    enforce run order. This run order will ensure that the instance
    generated during LiveMigratateServerWithVolumeTests setUpClass
    is setup and then migrated in the appropriate order for these tests.
    """
    suite = TestSuite()

    # During the LiveMigratateServerWithVolumeTests setup an instance is
    # created that will be used for the tests in this test module
    suite.addTest(
        LiveMigratateServerWithVolumeTests("test_format_and_mount_disks"))
    # This test performs a live migrate on the instance
    suite.addTest(
        LiveMigratateServerWithVolumeTests("test_live_migrate_server"))
    suite.addTest(
        LiveMigratateServerWithVolumeTests(
            "test_verify_ephemeral_disks_mounted"))
    suite.addTest(
        LiveMigratateServerWithVolumeTests(
            "test_volume_attached_after_migration"))
    return suite
예제 #13
0
def make_suite(model: dict,
               context: ChainMap = None,
               client: HttpClient = None) -> TestSuite:
    suite = TestSuite()

    suite.name = compile_data(model.get('name', ''))(context)

    for item in model.get('tests', []):
        # 编译数据
        parameters = compile_data(item.get('parameters', [{}]))
        variables = compile_data(item.get('variables', {}))

        # 参数化处理
        for parameter in parameters(context):
            # 创建子上下文
            child_context = context.new_child(parameter)

            # 合并变量
            child_context.update(variables(child_context))

            # 创建测试用例
            suite.addTest(
                make_testcase(item,
                              client=client,
                              context=child_context,
                              parent=suite))

    return suite
예제 #14
0
 def runTest():
     suite = TestSuite()
     suite.addTest(self.test)
     runner = _TestRunner()
     result = runner.run(suite)
     if result.err is not None:
         desc = result.err[1].message + "\n" + "".join(traceback.format_tb(result.err[2]))
         raise Exception(desc)
예제 #15
0
    def build_suite(self, *args, **kwargs):
        suite = super(CustomizedRunner, self).build_suite(*args, **kwargs)
        filtered = TestSuite()

        for test in suite:
            testname = str(test)
            if '.tests.' in testname and self.package in testname:
                filtered.addTest(test)
        return filtered
예제 #16
0
 def _runTest(self):
     """method used to run a test."""
     suite = TestSuite()
     suite.addTest(self.test)
     runner = _TestRunner()
     result = runner.run(suite)
     if result.err is not None:
         desc = str(result.err) + "\n" + \
                "".join(traceback.format_tb(result.err[2]))
         raise Exception(desc)
예제 #17
0
 def _runTest(self):
     """method used to run a test."""
     suite = TestSuite()
     suite.addTest(self.test)
     runner = _TestRunner()
     result = runner.run(suite)
     if result.err is not None:
         desc = str(result.err) + "\n" + \
                "".join(traceback.format_tb(result.err[2]))
         raise Exception(desc)
def load_tests(loader, standard_tests, pattern):
    """
    Generate a test suite of tests from several test classes.

    Specifically:
        - test_volume_attached_after_migration from
            LiveMigratateServerWithVolumeTests
        - test_format_and_mount_disks, test_live_migrate_server,
          test_verify_ephemeral_disks_mounted from
          LiveMigratateServerWithVolumeTests

    These tests are added in a specific order to the load_tests method to
    enforce run order. This run order will ensure that the instance
    generated during LiveMigratateServerWithVolumeTests setUpClass
    is setup and then migrated in the appropriate order for these tests.
    """
    suite = TestSuite()

    # During the LiveMigratateServerWithVolumeTests setup an instance is
    # created that will be used for the tests in this test module
    suite.addTest(LiveMigratateServerWithVolumeTests(
        "test_format_and_mount_disks"))
    # This test performs a live migrate on the instance
    suite.addTest(LiveMigratateServerWithVolumeTests(
        "test_live_migrate_server"))
    suite.addTest(LiveMigratateServerWithVolumeTests(
        "test_verify_ephemeral_disks_mounted"))
    suite.addTest(LiveMigratateServerWithVolumeTests(
        "test_volume_attached_after_migration"))
    return suite
예제 #19
0
def suite():
  suite = TestSuite()
  suite.addTest(SimpleKindAwareInsertTest())
  suite.addTest(KindAwareInsertWithParentTest())
  suite.addTest(SimpleKindAwareQueryTest())
  suite.addTest(AncestorQueryTest())
  return suite
예제 #20
0
 def _runTest(self):
     """Method used to run a test"""
     suite = TestSuite()
     suite.addTest(self.test)
     runner = _TestRunner()
     result = runner.run(suite)
     if result.err is not None:
         desc = str(result.err) + '\n' + ''.join(traceback.format_tb(result.err[2]))
         if isinstance(result.err[1], AssertionError):
             raise AssertionError(desc)
         else:
             raise Exception(desc)
예제 #21
0
    def _get_suite(self, test_labels, discover_kwargs, extra_tests, methods):
        suite = TestSuite()
        for label in test_labels:
            kwargs = discover_kwargs.copy()
            tests = None

            label_as_path = os.path.abspath(label)

            # if a module, or "module.ClassName[.method_name]", just run those
            if not os.path.exists(label_as_path):
                tests = self.test_loader.loadTestsFromName(label)
            elif os.path.isdir(label_as_path) and not self.top_level:
                # Try to be a bit smarter than unittest about finding the
                # default top-level for a given directory path, to avoid
                # breaking relative imports. (Unittest's default is to set
                # top-level equal to the path, which means relative imports
                # will result in "Attempted relative import in non-package.").

                # We'd be happy to skip this and require dotted module paths
                # (which don't cause this problem) instead of file paths (which
                # do), but in the case of a directory in the cwd, which would
                # be equally valid if considered as a top-level module or as a
                # directory path, unittest unfortunately prefers the latter.

                top_level = label_as_path
                while True:
                    init_py = os.path.join(top_level, '__init__.py')
                    if os.path.exists(init_py):
                        try_next = os.path.dirname(top_level)
                        if try_next == top_level:
                            # __init__.py all the way down? give up.
                            break
                        top_level = try_next
                        continue
                    break
                kwargs['top_level_dir'] = top_level

            if not (tests and tests.countTestCases()):
                # if no tests found, it's probably a package; try discovery
                tests = self.test_loader.discover(start_dir=label, **kwargs)

                # make unittest forget the top-level dir it calculated from this
                # run, to support running tests from two different top-levels.
                self.test_loader._top_level_dir = None

            tests = self.get_tests_defined_in_methods_or_none(tests, methods)
            if tests:
                suite.addTests(tests)

        for test in extra_tests:
            suite.addTest(test)
        return suite
예제 #22
0
def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(
        DeactivateReactivateServers('test_deactivate_snapshot_image'))
    suite.addTest(
        DeactivateReactivateServers(
            'test_create_server_from_deactivated_image_invalid'))
    suite.addTest(
        DeactivateReactivateServers('test_reactivate_snapshot_image'))
    suite.addTest(
        DeactivateReactivateServers(
            'test_create_server_from_reactivated_image'))
    return suite
def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(LiveMigratationServerTests("test_format_and_mount_disks"))
    suite.addTest(LiveMigratationServerTests("test_live_migrate_server"))
    suite.addTest(
        LiveMigratationServerTests("test_verify_ephemeral_disks_mounted"))
    return suite
예제 #24
0
def main():
    dt_suite = doctest.DocTestSuite(test_finder=doctest.DocTestFinder(
        recurse=True))
    dt_suite.countTestCases()
    dt_suite.debug()
    if pytest is None:
        suite = TestSuite()
        all_test_suites = unittest.defaultTestLoader.discover(start_dir="test")
        suite.addTests(tests=[all_test_suites, dt_suite])
        logging.debug(vars(suite))
        successful = TextTestRunner().run(suite).wasSuccessful()
        return 0 if successful else 1
    else:
        pytest.main(plugins=[])
예제 #25
0
 def run(self):
     global THIS_PATH, PKG_DIR, TEST_DIR
     
     sys.path.insert(0, PKG_DIR)
     
     suite = TestSuite()
     loaded = unittest.defaultTestLoader.discover(TEST_DIR, pattern='*Test.py')
     
     for all_test_suite in loaded:
         for test_suite in all_test_suite:
             suite.addTests(test_suite)
     
     runner = TextTestRunner(verbosity = 2)
     runner.run(suite)
def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(DeactivateReactivateServers(
        'test_deactivate_snapshot_image'))
    suite.addTest(DeactivateReactivateServers(
        'test_create_server_from_deactivated_image_invalid'))
    suite.addTest(DeactivateReactivateServers(
        'test_reactivate_snapshot_image'))
    suite.addTest(DeactivateReactivateServers(
        'test_create_server_from_reactivated_image'))
    return suite
예제 #27
0
  def __init__(self, name, short_name):
    """
    Create a new instance of HawkeyeTestSuite with the given name and short
    name. Use the addTest instance method to add test cases to the suite.

    Args:
      name  A descriptive name for the test suite
      short_name  A shorter but unique name for the test suite. Should be
                  ideally just one word. This short name is used to name
                  log files and other command line options related to this
                  test suite.
    """
    TestSuite.__init__(self)
    self.name = name
    self.short_name = short_name
def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(RebuildServerVolumeIntegrationTest(
        "test_rebuild_server"))
    suite.addTest(RebuildServerVolumeIntegrationTest(
        "test_volume_detached_after_rebuild"))
    suite.addTest(RebuildServerVolumeIntegrationTest(
        "test_reattach_volume_after_rebuild"))
    return suite
def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(VerifyComputePersistentResources(
        "test_verify_persistent_servers_existance"))
    suite.addTest(VerifyComputePersistentResources(
        "test_can_ssh_into_persistent_servers"))
    suite.addTest(VerifyComputePersistentResources(
        "test_suspend_resume_persistent_server"))
    return suite
예제 #30
0
def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(
        VerifyObjectStoragePersistentResources(
            "test_verify_persistent_container_existance"))
    suite.addTest(
        VerifyObjectStoragePersistentResources(
            "test_list_persistent_container_contents"))
    suite.addTest(
        VerifyObjectStoragePersistentResources("test_get_persistent_object"))
    return suite
예제 #31
0
def load_tests(loader, tests, pattern):
    suite = TestSuite()
    suite.addTests(load_testsuite(loader, dirname(__file__)))
    # Numba CUDA tests are located in a separate directory:
    cuda_dir = join(dirname(dirname(__file__)), 'cuda/tests')
    suite.addTests(loader.discover(cuda_dir))

    # Numba ROC tests are located in a separate directory
    roc_dir = join(dirname(dirname(__file__)), 'roc/tests')
    suite.addTests(loader.discover(roc_dir))

    return suite
def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(LiveMigratationServerTests(
        "test_format_and_mount_disks"))
    suite.addTest(LiveMigratationServerTests(
        "test_live_migrate_server"))
    suite.addTest(LiveMigratationServerTests(
        "test_verify_ephemeral_disks_mounted"))
    return suite
예제 #33
0
def creat():
    loadcase=TestLoader()
    testsuite=[]
    suite1=TestSuite()
    suite2=TestSuite()
    caseclass_dict={}
    def backcount(d):
        n=0
        for i in d.values():
            n+=i
        return n
    def caseclass_count(caselist):
        print 'dir caselist',caselist
        for casename in caselist:
            module=loadcase._get_module_from_name(casename)
            for name in dir(module):
                obj = getattr(module,name)
                if isinstance(obj, type) and issubclass(obj, case.TestCase):
                    modeltestcases_list=getTestCaseNames(obj,'test')
                    caseclass_dict[obj]=len(modeltestcases_list)
        return caseclass_dict
예제 #34
0
def run_test(path: str = 'testcase'):
    """
    :param path: With default path testcase, the method will execute all testcases, otherwise it only execute the
    cases which in the specific path
    :return: test report
    """
    report_name = "{}_{}".format(path,
                                 str(datetime.now().strftime("%Y%m%d%H%M")))
    testsuits = TestSuite()

    if path == 'testcase':
        for dir in os.listdir(os.path.join(os.curdir, path)):
            testsuits.addTests(
                unittest.defaultTestLoader.discover(dir,
                                                    pattern='*test.py',
                                                    top_level_dir='testcase'))
    else:
        testsuits.addTests(
            unittest.defaultTestLoader.discover(path,
                                                pattern='*test.py',
                                                top_level_dir='testcase'))

    result = BeautifulReport(testsuits)
    result.report(filename=report_name, description=path, log_path='result')
    shutil.copy('result/%s.html' % report_name, 'result/test_api_ressult.html')
    if result.failure_count or result.error_count:
        #主动出发失败导致jenkins失败
        raise Exception("主动失败,发送邮件")
예제 #35
0
def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(CreateServerVolumeBurnIn("test_create_server_burn_in"))
    suite.addTest(CreateServerVolumeBurnIn("test_create_volume_burn_in"))
    suite.addTest(
        CreateServerVolumeBurnIn("test_attach_volume_to_server_burn_in"))
    return suite
def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(
        CreateServerVolumeIntegrationTest("test_attach_volume_to_server"))
    suite.addTest(
        CreateServerVolumeIntegrationTest("test_format_and_mount_volume"))
    return suite
예제 #37
0
def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(ResizeServerVolumeIntegrationTest(
        "test_resize_server_and_confirm"))
    suite.addTest(ResizeServerVolumeIntegrationTest(
        "test_volume_attached_after_resize"))
    return suite
def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(
        ObjectStoragePersistentResources("test_create_persistent_container"))
    suite.addTest(
        ObjectStoragePersistentResources("test_create_persistent_object"))
    return suite
예제 #39
0
def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(
        MultipleContainersTest(
            "test_custom_container_present_after_image_create"))
    suite.addTest(
        MultipleContainersTest(
            "test_custom_container_present_after_image_delete"))
    return suite
예제 #40
0
 def get_tests_defined_in_methods_or_none(self, tests, methods):
     if not methods:
         return tests
     else:
         if isinstance(tests, TestSuite):
             returned_tests = []
             for test in tests:
                 returned_test = self.get_tests_defined_in_methods_or_none(
                     test, methods)
                 if returned_test:
                     returned_tests.append(returned_test)
             return TestSuite(returned_tests)
         elif tests._testMethodName in methods:
             return tests
         else:
             return None
예제 #41
0
def test_package(*package_names):
    tests = []
    test_loader = TestLoader()
    for module_name, module in sys.modules.items():
        for package_name in package_names:
            if module_name.startswith('{}.'.format(package_name)):
                module_tests = test_loader.loadTestsFromModule(module)
                module_tests = [
                    t for t in module_tests if is_test_suite_loaded(t)
                ]
                tests.extend(module_tests)
                break
    test_result = TextTestRunner(failfast=True,
                                 resultclass=TimedTextTestResult).run(
                                     TestSuite(tests))
    if not test_result.wasSuccessful():
        raise Exception('test failed')
예제 #42
0
def main() -> int:
    args = _parse_args()
    suite = defaultTestLoader.discover(normcase(_TESTS),
                                       top_level_dir=normcase(_ROOT),
                                       pattern="*.py")
    names = {*_names(args.paths)}
    tests = (test for test in _tests(suite)
             if not names or test.__module__ in names)

    runner = TextTestRunner(
        verbosity=args.verbosity,
        failfast=args.fail,
        buffer=args.buffer,
    )
    installHandler()
    r = runner.run(TestSuite(tests))
    return not r.wasSuccessful()
예제 #43
0
    def _getTestSuite(self) -> TestSuite:
        """

        Returns:
            A suite of all tests in the unit test directory
        """
        modules: List[str] = self.__getTestableModuleNames()
        fSuite: TestSuite = TestSuite()
        for module in modules:
            try:
                fixedName: str = module.replace('/', '.')
                m = import_module(fixedName)
                fSuite.addTest(m.suite())
            except (ValueError, Exception) as e:
                self.logger.error(
                    f'Module import problem with: {module}:  {e}')
        return fSuite
예제 #44
0
    def _get_suite(self, test_labels, discover_kwargs, extra_tests, methods):
        suite = TestSuite()
        for label in test_labels:
            kwargs = discover_kwargs.copy()
            tests = None

            label_as_path = os.path.abspath(label)

            # if a module, or "module.ClassName[.method_name]", just run those
            if not os.path.exists(label_as_path):
                tests = self.test_loader.loadTestsFromName(label)
            elif os.path.isdir(label_as_path) and not self.top_level:
                # Try to be a bit smarter than unittest about finding the
                # default top-level for a given directory path, to avoid
                # breaking relative imports. (Unittest's default is to set
                # top-level equal to the path, which means relative imports
                # will result in "Attempted relative import in non-package.").

                # We'd be happy to skip this and require dotted module paths
                # (which don't cause this problem) instead of file paths (which
                # do), but in the case of a directory in the cwd, which would
                # be equally valid if considered as a top-level module or as a
                # directory path, unittest unfortunately prefers the latter.

                top_level = label_as_path
                while True:
                    init_py = os.path.join(top_level, '__init__.py')
                    if os.path.exists(init_py):
                        try_next = os.path.dirname(top_level)
                        if try_next == top_level:
                            # __init__.py all the way down? give up.
                            break
                        top_level = try_next
                        continue
                    break
                kwargs['top_level_dir'] = top_level

            if not (tests and tests.countTestCases()):
                # if no tests found, it's probably a package; try discovery
                tests = self.test_loader.discover(start_dir=label, **kwargs)

                # make unittest forget the top-level dir it calculated from this
                # run, to support running tests from two different top-levels.
                self.test_loader._top_level_dir = None

            tests = self.get_tests_defined_in_methods_or_none(tests, methods)
            if tests:
                suite.addTests(tests)

        for test in extra_tests:
            suite.addTest(test)
        return suite
예제 #45
0
    def to_suite(self, tests):
        """
    Creates the container TestSuite object and populate with the TestCase
    objects based on the given test config objects.

    :param tests: test case config objects
    :type tests: list[RunnableTestCaseInfo]
    :return: overall TestSuite object
    :rtype: TestSuite
    """
        test_cases = list()
        for case_info in tests:
            try:
                test_cases.append(self.build_from_config(case_info=case_info))
            except Exception as e:
                log.error("Testcase loading failed: %s" % e.message)
                continue
        return TestSuite(test_cases)
예제 #46
0
def creat():
    loadcase=TestLoader()
    testsuite=[]
    suite1=TestSuite()
    suite2=TestSuite()
    caseclass_dict={}
    def backcount(d):
        n=0
        for i in d.values():
            n+=i
        return n
    def caseclass_count(caselist):
        print 'dir caselist',caselist
        for casename in caselist:
            module=loadcase._get_module_from_name(casename)
            for name in dir(module):
                obj = getattr(module,name)
                if isinstance(obj, type) and issubclass(obj, case.TestCase):
                    modeltestcases_list=getTestCaseNames(obj,'test')
                    caseclass_dict[obj]=len(modeltestcases_list)
        return caseclass_dict
    classcase_dict=caseclass_count(backcaselist(dirs+'/bank_case'))
    
    case_and_count_list=back_list(classcase_dict)
    sort_case=SelectSort(case_and_count_list)
    print sort_case
    for i in range(len(sort_case)):
        if i%2==0:
            suite1.addTest(loadcase.loadTestsFromTestCase([x for x in sort_case[i].keys()][0]))
            [x for x in sort_case[i].keys()][0].remoteip='http://172.17.2.136:3344/wd/hub'
        else:
            suite2.addTest(loadcase.loadTestsFromTestCase([x for x in sort_case[i].keys()][0]))
            [x for x in sort_case[i].keys()][0].remoteip='http://172.17.2.57:3344/wd/hub'
    
    print 'suite1',suite1
    print 'suite2',suite2
    testsuite.append(suite1)
    testsuite.append(suite2)
    return testsuite
예제 #47
0
def load_tests(loader, tests, pattern):
    suite = TestSuite()
    for test_module in test_cases:
        tests = loader.loadTestsFromModule(test_module)
        suite.addTests(tests)
    return suite
예제 #48
0
        inst = LucteriosInstance("inst_psql", self.path_dir)
        inst.delete()
        self.assertEqual([], self.luct_glo.listing())

    def test_archive(self):
        self.assertEqual([], self.luct_glo.listing())
        inst = LucteriosInstance("inst_h", self.path_dir)
        inst.add()
        inst.filename = join(self.path_dir, "inst_h.arc")
        self.assertEqual(True, inst.archive())

        inst = LucteriosInstance("inst_psql", self.path_dir)
        inst.set_database(
            "postgresql:name=" + self.data['dbname'] + ",user=puser,password=123456,host=localhost")
        inst.add()
        inst.filename = join(self.path_dir, "inst_h.arc")
        self.assertEqual(True, inst.restore())


if __name__ == "__main__":
    suite = TestSuite()
    loader = TestLoader()
    suite.addTest(loader.loadTestsFromTestCase(TestAdminSQLite))
    suite.addTest(loader.loadTestsFromTestCase(TestAdminMySQL))
    suite.addTest(loader.loadTestsFromTestCase(TestAdminPostGreSQL))
    suite.addTest(loader.loadTestsFromTestCase(TestGlobal))
    JUXDTestRunner(verbosity=1).run(suite)
else:
    setup_from_none()
def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(CreateServerVolumeBurnIn("test_create_server_burn_in"))
    suite.addTest(CreateServerVolumeBurnIn("test_create_volume_burn_in"))
    suite.addTest(CreateServerVolumeBurnIn("test_attach_volume_to_server_burn_in"))
    return suite
예제 #50
0
파일: admin_test.py 프로젝트: povtux/core
        inst = LucteriosInstance("inst_psql", self.path_dir)
        inst.set_database(
            "postgresql:name=" + self.data['dbname'] + ",user=puser,password=123456,host=localhost")
        inst.add()
        inst.filename = join(self.path_dir, "inst_h.arc")
        self.assertEqual(True, inst.restore())

    def test_migration(self):
        self.assertEqual([], self.luct_glo.listing())

        inst = LucteriosInstance("inst_psql", self.path_dir)
        inst.set_database(
            "postgresql:name=" + self.data['dbname'] + ",user=puser,password=123456,host=localhost")
        inst.add()
        self.assertEqual(["inst_psql"], self.luct_glo.listing())
        mirg = MigrateFromV1("inst_psql", self.path_dir, "")
        mirg.filename = join(
            dirname(self.path_dir), 'data', 'archive_demo.bkf')
        mirg.restore()

if __name__ == "__main__":
    suite = TestSuite()
    loader = TestLoader()
    # suite.addTest(loader.loadTestsFromTestCase(TestAdminSQLite))
    # suite.addTest(loader.loadTestsFromTestCase(TestAdminMySQL))
    # suite.addTest(loader.loadTestsFromTestCase(TestAdminPostGreSQL))
    suite.addTest(loader.loadTestsFromTestCase(TestGlobal))
    JUXDTestRunner(verbosity=1).run(suite)
else:
    setup_from_none()
def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(RebuildServerVolumeIntegrationTest("test_rebuild_server"))
    suite.addTest(RebuildServerVolumeIntegrationTest("test_volume_detached_after_rebuild"))
    suite.addTest(RebuildServerVolumeIntegrationTest("test_reattach_volume_after_rebuild"))
    return suite
예제 #52
0
        for seq in go.all_seqs:
            self.assertTrue(seq.seq_id in expected, seq.seq_id)

        go = GOConnector(record_index, batch_size, tempfile=self.tempfile)
        count = go.amigo_batch_mode()  # do nothing
        self.assertEqual(0, count)


        tempout = open(self.tempfile, "r")
        all_lines = tempout.readlines()
        tempout.close()
        tempout = open(self.tempfile, "w")
        for line in all_lines:
            tempout.write(line)
            if line.startswith("ENDResult"):
                break
        tempout.close()

        go = GOConnector(record_index, batch_size, tempfile=self.tempfile)
        resume_count = go.amigo_batch_mode()
        self.assertEqual(expected_count - 1, resume_count)

if __name__ == '__main__':
#    unittest.main(verbosity=2)
#    Test = TestGoConnector()
    suite = TestSuite()
#    suite.addTest(TestGoConnector("test_parse_seq"))
    suite.addTest(TestGoConnector("test_batch_mode"))
#    suite.addTest(TestGoConnector("test_GoConnector_long"))
    unittest.TextTestRunner().run(suite)
def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(ResizeServerBurnIn("test_resize_server"))
    suite.addTest(ResizeServerBurnIn("test_resize_server_confirm"))
    return suite
def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(CreateServerBurnIn("test_create_server_burn_in"))
    suite.addTest(CreateServerBurnIn("test_can_ping_created_server"))
    suite.addTest(CreateServerBurnIn("test_can_ssh_into_created_server"))
    return suite
예제 #55
0
def load_tests(loader, tests, pattern):
    suite = TestSuite()
    suite.addTests(load_testsuite(loader, dirname(__file__)))
    return suite
예제 #56
0
파일: s2ex1.py 프로젝트: nka11/coursera-uC
    assert(self.device.GetPin(self.LED1).toChar() == "H")
    assert(self.device.GetPin(self.LED2).toChar() == "H")
    self.doRun(2500000) # 25ms
    assert(self.device.GetPin(self.LED1).toChar() == "H")
    assert(self.device.GetPin(self.LED2).toChar() == "H")
    # Deuxieme seconde
    self.doRun(2500000) # 25ms
    assert(self.device.GetPin(self.LED1).toChar() == "L")
    assert(self.device.GetPin(self.LED2).toChar() == "H")
    self.doRun(2500000) # 25ms
    assert(self.device.GetPin(self.LED1).toChar() == "L")
    assert(self.device.GetPin(self.LED2).toChar() == "H")
    self.doRun(2500000) # 25ms
    assert(self.device.GetPin(self.LED1).toChar() == "L")
    assert(self.device.GetPin(self.LED2).toChar() == "H")
    self.doRun(2500000) # 25ms
    assert(self.device.GetPin(self.LED1).toChar() == "L")
    assert(self.device.GetPin(self.LED2).toChar() == "H")
    self.doRun(2500000) # 25ms
    assert(self.device.GetPin(self.LED1).toChar() == "L")
    assert(self.device.GetPin(self.LED2).toChar() == "L")



if __name__ == "__main__":
  allTestsFrom = defaultTestLoader.loadTestsFromTestCase
  suite = TestSuite()
  suite.addTests(allTestsFrom(TestEx1Semaine2))
  TextTestRunner(verbosity = 2).run(suite)

def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(RescueServerBurnIn("test_rescue_server"))
    suite.addTest(RescueServerBurnIn("test_unrescue_server"))
    return suite