예제 #1
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
예제 #2
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
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
예제 #4
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
예제 #5
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(CreateServerVolumeIntegrationTest(
        "test_attach_volume_to_server"))
    suite.addTest(CreateServerVolumeIntegrationTest(
        "test_format_and_mount_volume"))
    return suite
예제 #7
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
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(
        ObjectStoragePersistentResources("test_create_persistent_container"))
    suite.addTest(
        ObjectStoragePersistentResources("test_create_persistent_object"))
    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
예제 #12
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)
예제 #13
0
def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(
        DeactivateReactivateBFV(
            'test_create_volume_server_from_deactivated_image_invalid'))
    suite.addTest(
        DeactivateReactivateBFV(
            'test_create_volume_server_from_reactivated_image'))
    return suite
예제 #14
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
예제 #15
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
예제 #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)
예제 #18
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)
예제 #19
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
예제 #20
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
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
예제 #22
0
def suite():
    suite = TestSuite()
    suite.addTest(SimpleKindAwareInsertTest())
    suite.addTest(KindAwareInsertWithParentTest())
    suite.addTest(SimpleKindAwareQueryTest())
    suite.addTest(AncestorQueryTest())
    return suite
예제 #23
0
def suite():
  suite = TestSuite()
  suite.addTest(SimpleKindAwareInsertTest())
  suite.addTest(KindAwareInsertWithParentTest())
  suite.addTest(SimpleKindAwareQueryTest())
  suite.addTest(AncestorQueryTest())
  return suite
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
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
예제 #27
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
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
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(LiveMigratationServerTests(
        "test_format_and_mount_disks"))
    suite.addTest(LiveMigratationServerTests(
        "test_live_migrate_server"))
    suite.addTest(LiveMigratationServerTests(
        "test_verify_ephemeral_disks_mounted"))
    return suite
예제 #31
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
예제 #32
0
 def load_test_from_names(self, test_names):
     suite = TestSuite()
     for test_name in test_names:
         tests = unittest.defaultTestLoader.loadTestsFromName(test_name)
         suite.addTest(tests)
     return suite
예제 #33
0
 def load_test_from_suite(self, test_modules):
     suite = TestSuite()
     for test_module in test_modules:
         tests = unittest.defaultTestLoader.loadTestsFromModule(test_module)
         suite.addTest(tests)
     return suite
예제 #34
0
        r = Antlr4parser().from_str(r_str)
        _selection_options_to_sequnces(r)
        res, _ = _selection_propagate_optionality(r)
        self.assertTextEq(expec, res.toAntlr4())

    def test_selection_propagate_optionality2(self):
        r_str = "( a )? ( a1 )* | b | ( c )?"
        expec = "( a ( a1 )* | ( a1 )+ | b | c)?"
        r = Antlr4parser().from_str(r_str)
        _selection_options_to_sequnces(r)
        res, _ = _selection_propagate_optionality(r)
        self.assertTextEq(expec, res.toAntlr4())

    def test_selection_propagate_optionality3(self):
        r_str = "b | ( a )? ( a1 )* ( a2 )* | ( c )?"
        expec = "( b | a ( a1 )* ( a2 )* | ( a1 )+ ( a2 )* | ( a2 )+ | c)?"
        r = Antlr4parser().from_str(r_str)
        _selection_options_to_sequnces(r)
        res, _ = _selection_propagate_optionality(r)
        self.assertTextEq(expec, res.toAntlr4())


if __name__ == '__main__':
    suite = TestSuite()
    # suite.addTest(SelectionOptimizerTC('test_p584'))

    suite.addTest(unittest.makeSuite(SelectionOptimizerTC))

    runner = TextTestRunner(verbosity=3)
    runner.run(suite)
예제 #35
0
    def test_get_feature(self, feature_id=1971, feature_name='yjl001W'):
        from model_old_schema.feature import Feature
        f = get_first(Feature, id=feature_id)
        self.model.execute(test_validity(self, f, validate_feature, feature_id=feature_id, feature_name=feature_name))
        
    def test_get_reftemp(self, reftemp_id=81007, pubmed_id=23125886):
        from model_old_schema.reference import RefTemp
        reftemp = get_first(RefTemp, id=reftemp_id)
        self.model.execute(test_validity(self, reftemp, validate_reftemp, reftemp_id=reftemp_id, pubmed_id=pubmed_id))
    
    def test_get_refbad(self, pubmed_id=16998476):
        from model_old_schema.reference import RefBad
        refbad = get_first(RefBad, pubmed_id=pubmed_id)
        self.model.execute(test_validity(self, refbad, validate_refbad, pubmed_id=pubmed_id))
            
    def test_get_ref(self, pubmed_id=1986222, ref_id=84):
        from model_old_schema.reference import Reference
        ref = get_first(Reference, id=ref_id)
        self.model.execute(test_validity(self, ref, validate_ref, ref_id=ref_id))
                
    def test_count_refs(self):
        from model_old_schema.reference import Reference
        ref_count = self.model.execute(count(Reference))
        self.assertTrue(ref_count > 0)
            
if __name__ == '__main__':
    suite = TestSuite()
    suite.addTest(TestGetFeaturesAndReferences('test_get_references'))
    unittest.TextTestRunner().run(suite)
    
예제 #36
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)
예제 #37
0
def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(RescueServerBurnIn("test_rescue_server"))
    suite.addTest(RescueServerBurnIn("test_unrescue_server"))
    return suite
            or module_name.startswith('apispec')
            or module_name.startswith('aiohttp')):
        del sys.modules[module_name]

cov = coverage.Coverage(data_file=data_file, data_suffix=True, config_file=False,
                        branch=True, source=['ipv8'], include=['*'], omit=["ipv8/test/*", "ipv8_service.py"])
cov.exclude('pass')
cov.start()

for test_path in test_paths:
    print("Measuring coverage for", test_path)

    output_stream = StringIO()

    suite = TestSuite()
    suite.addTest(defaultTestLoader.loadTestsFromName(test_path))
    reporter = TextTestRunner(stream=output_stream, failfast=True)
    test_result = reporter.run(suite)

    error_string = ''.join([repr(error) for error in test_result.errors])
    assert len(test_result.errors) == 0,\
        "ERROR: UNIT TESTS FAILED, PLEASE FIX BEFORE RUNNING COVERAGE:\n%s\n%s" % (output_stream.getvalue(),
                                                                                   error_string)
    output_stream.close()

cov.stop()
print("Generating HTML report")
cov.html_report(directory='coverage')

print("Aggregating package stats")
total_numbers = {}  # Package name -> (Numbers: package coverage stats, dict: files per coverage bin)
def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(ResizeServerBurnIn("test_resize_server"))
    suite.addTest(ResizeServerBurnIn("test_resize_server_confirm"))
    return suite
예제 #40
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
    """

    host = g.host
    method = g.get_info('config_info', 'method')
    testsuits = TestSuite()

    report_name = "{}_{}".format(path,
                                 str(datetime.now().strftime("%Y%m%d%H%M%S")))

    copyname = 'testReport/test_api_ressult.html'
    # 保证连接正常,testdata做了断网简单兼容,此处也做兼容
    if host == "http://backend.pre.igengmei.com":
        host = "https://backend.igengmei.com"
    try:
        a = requests.get(f"http://{g.server_host}/testapi/checkedapi/",
                         params={
                             'env': host,
                             "method": method
                         }).json()
        with open(case_file, 'w', encoding='utf-8') as f:
            f.write(json.dumps(a))
    except Exception:
        with open(case_file, 'r', encoding='utf-8') as f:
            _data = f.read()
        a = eval(_data)
    _a = copy.deepcopy(a)
    for case in a:
        _unit = unittest.defaultTestLoader.discover(path,
                                                    pattern=case + '_test.py',
                                                    top_level_dir='testCase')
        # print(_unit.__dict__) if case=='account_login_login_vfc' else None
        if _unit.__dict__.get('_tests'):
            testsuits.addTest(_unit)
            _a.remove(case)
    result = BeautifulReport(testsuits)
    result.report(filename=report_name,
                  description="API接口",
                  log_path='testReport')
    shutil.copy('testReport/%s.html' % report_name, copyname)

    result_list = [item for item in result.result_list if item[4] != '成功']
    # 我们需要获取已经记录但是没有写脚本的接口和case,收录在_a中

    from PIL import Image, ImageDraw, ImageFont

    length, weight_unit = 1000, 20
    back_img = Image.new(mode='RGB',
                         size=(length, weight_unit *
                               ((len(result_list) or 1) + len(_a) + 2)),
                         color=(255, 255, 255))
    draw_img = ImageDraw.ImageDraw(back_img)
    font = ImageFont.truetype('arial.ttf', size=weight_unit, encoding='gbk')

    num = 0
    if len(result_list) == 0:
        draw_img.text((0, weight_unit * num),
                      'ALL PASS!',
                      font=font,
                      fill='green')
        num += 1
    for item in result_list:
        draw_img.text((0, weight_unit * num),
                      item[0] + ':' + item[1],
                      font=font,
                      fill='red')
        num += 1
    if _a:
        draw_img.text((0, weight_unit * num),
                      'The following interface scripts are missing!!',
                      font=font,
                      fill='red')
        num += 1
        for item in _a:
            draw_img.text((0, weight_unit * num), item, font=font, fill='blue')
            num += 1
    back_img.save('testReport/error.jpg')
    if len(result_list) > 0:
        #主动跑错
        raise Exception('有接口没有执行通过!')
예제 #41
0
        action.send_keys(Keys.TAB).perform()
        #get invalid messages for empty data in email, password, verify password fields
        message1 = register.invalid_message_for_email()
        message2 = register.invalid_message_for_password()
        message3 = register.invalid_verify_password_message()

        if message1 == message2 == message3 == 'Vul het veld in':
            print('Message displayed correctly for invalid data')
        time.sleep(10)

    @classmethod
    def tearDownClass(cls):
        cls.driver.close()
        cls.driver.quit()
        print('Test-3 completed')


if __name__ == '__main__':
    unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output='Reports'))
    #create a suite()
    suite = TestSuite()
    # Load all tests
    tests = unittest.TestLoader()
    suite1 = suite.addTest(tests.loadTestsFromTestCase(TestOne))
    suite2 = suite.addTest(tests.loadTestsFromTestCase(TestTwo))
    suite3 = suite.addTest(tests.loadTestsFromTestCase(TestThree))

    # Create runner to run the tests
    runner = unittest.TextTestRunner()
    runner.run(suite)
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
예제 #43
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(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
예제 #45
0
            
            result = associate(pubmed_id, name_to_feature, tasks, session=session)
            self.assertTrue(result)
            
            
            curations = get_first(Reference, session=session, pubmed_id=pubmed_id).curations
            lit_guides = get_first(Reference, session=session, pubmed_id=pubmed_id).litGuides
            
            self.assertEqual(len(curations), 9)
            for curation in curations:
                self.assertTrue(curation.comment is not None)
                
                if curation.task == 'Gene Link':
                    self.assertTrue(False, 'The two Tasks with name Gene Link: ADD_TO_DATABASE and REVIEWS have no genes. They should not have curaitons.')
                   
            self.assertEqual(len(lit_guides), 6)
            for lit_guide in lit_guides:
                if curation.task == 'Reviews':
                    self.assertEqual(len(lit_guide.features), 0)
                
        #Because commit=False, the associations are not committed to the db.
        self.model.execute(f, commit=False)

        
        
if __name__ == '__main__':
    suite = TestSuite()
    suite.addTest(TestMoveRefQueries('test_move_refbad_to_reftemp'))
    unittest.TextTestRunner().run(suite)
    
예제 #46
0
파일: parser.py 프로젝트: packet/packet
def suite():
  test_suite = TestSuite()
  test_suite.addTest(makeSuite(TestParser))
  return test_suite
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
예제 #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()
예제 #49
0
 def load_test_from_class(self, test_calsses):
     suite = TestSuite()
     for test_class in test_calsses:
         tests = unittest.defaultTestLoader.loadTestsFromTestCase(test_class)
         suite.addTest(tests)
     return suite
def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(CreateServerBurnIn("test_create_server"))
    suite.addTest(CreateServerBurnIn("test_can_ping_created_server"))
    return suite
예제 #51
0
                    "C":set(["D9", "DX"])
                    }

        for key, value in result.iteritems():
            self.assertEqual(expected[key], set(value))


    def test_get_seq_from_name(self):
        taxa = ["fungal endophyte"]
        self.BLAST.get_seqs_from_names(taxa, None)

if __name__ == "__main__":
    print "main"

    suite = TestSuite()
    suite.addTest(TestRunBLAST("test_get_seq_from_name"))
#    suite.addTest(TestGoConnector("test_GoConnector_long"))
    unittest.TextTestRunner().run(suite)
#
#    all = range(31)
#    new_list = []
#    max = math.ceil(len(all) / 10.0)
#    print all, max
#    count = 0
#    while count < max:
#        t = all[(count * 10):((count + 1) * 10) ]
#        print t
#        new_list.append(t)
#        count += 1
#    print "=="
#    print new_list
def load_tests(loader, standard_tests, pattern):
    suite = TestSuite()
    suite.addTest(ResizeServerBurnIn("test_resize_server"))
    suite.addTest(ResizeServerBurnIn("test_resize_server_confirm"))
    return suite