Esempio n. 1
0
def make_tests(filter_rgx):
    """generate tests classes from test info
    
    return the list of generated test classes
    """
    if filter_rgx:
        is_to_run = re.compile(filter_rgx).search
    else:
        is_to_run = lambda x: 1
    tests = []
    for module_file, messages_file in get_tests_info('func_', '.py') + [('nonexistant', 'messages/nonexistant.txt')]:
        # skip those tests with python >= 2.3 since py2.3 detects them by itself
        if PY23 and module_file == "func_unknown_encoding.py": #"func_nonascii_noencoding.py"):
            continue
        pyrestr = module_file.rsplit('_py', 1)[-1][:-3]
        if pyrestr.isdigit(): # '24', '25'...
            if sys.version_info < tuple([int(i) for i in pyrestr]):
                continue
        if not is_to_run(module_file):
            continue
        base = module_file.replace('func_', '').replace('.py', '')
        dependencies = get_tests_info(base, '.py')
        
        class LintTestUsingModuleTC(LintTestUsingModule):
            module = module_file.replace('.py', '')
            output = messages_file
            depends = dependencies or None
            tags = testlib.Tags(('generated','pylint_input_%s' % module))
        tests.append(LintTestUsingModuleTC)

        if MODULES_ONLY:
            continue
        
        class LintTestUsingFileTC(LintTestUsingFile):
            module = module_file.replace('.py', '')
            output = exists(messages_file + '2') and (messages_file + '2') or messages_file
            depends = dependencies or None
            tags = testlib.Tags(('generated', 'pylint_input_%s' % module))
        tests.append(LintTestUsingFileTC)
        
##     # special test for f0003
##     module_file, messages_file in get_tests_info('func_f0003', '.pyc')
##     class LintTestSubclass(LintTest):
##         module = module_file.replace('.pyc', '')
##         output = messages_file
##         depends = dependencies or None
##     tests.append(LintTestSubclass)
            
    class LintBuiltinModuleTest(LintTestUsingModule):
        output = 'messages/builtin_module.txt'
        module = 'sys'
        def test_functionality(self):
            self._test(['sys'])
    tests.append(LintBuiltinModuleTest)
    
    if not filter_rgx:
        # test all features are tested :)    
        tests.append(TestTests)

    return tests
def make_tests(filter_rgx):
    """generate tests classes from test info
    
    return the list of generated test classes
    """
    if filter_rgx:
        is_to_run = re.compile(filter_rgx).match
    else:
        is_to_run = lambda x: 1
    tests = []
    for module_file, messages_file in get_tests_info('func_', '.py',
                                                     'rpythoninput', 'rpythonmessages'):
        if not is_to_run(module_file):
            continue
        base = module_file.replace('func_', '').replace('.py', '')
        dependancies = get_tests_info(base, '.py')
        
        class LintTestUsingFileTC(RLintTestUsingFile):
            module = module_file.replace('.py', '')
            output = exists(messages_file + '2') and (messages_file + '2') or messages_file
            depends = dependancies or None
        tests.append(LintTestUsingFileTC)
    
    if not filter_rgx:
        # test all features are tested :)    
        tests.append(TestTests)

    return tests
def make_tests(filter_rgx):
    """generate tests classes from test info
    
    return the list of generated test classes
    """
    if filter_rgx:
        is_to_run = re.compile(filter_rgx).match
    else:
        is_to_run = lambda x: 1
    tests = []
    for module_file, messages_file in get_tests_info('func_', '.py') + [('nonexistant', 'messages/nonexistant.txt')]:
        # skip those tests with python >= 2.3 since py2.3 detects them by itself
        if PY23 and module_file == "func_unknown_encoding.py": #"func_nonascii_noencoding.py"):
            continue
        if not PY24:
            if module_file == "func_noerror_staticmethod_as_decorator.py" or \
                   module_file.endswith('py24.py'):
                continue
        if not is_to_run(module_file):
            continue
        base = module_file.replace('func_', '').replace('.py', '')
        dependancies = get_tests_info(base, '.py')
        
        class LintTestUsingModuleTC(LintTestUsingModule):
            module = module_file.replace('.py', '')
            output = messages_file
            depends = dependancies or None
        tests.append(LintTestUsingModuleTC)

        if MODULES_ONLY:
            continue
        
        class LintTestUsingFileTC(LintTestUsingFile):
            module = module_file.replace('.py', '')
            output = exists(messages_file + '2') and (messages_file + '2') or messages_file
            depends = dependancies or None
        tests.append(LintTestUsingFileTC)
        
##     # special test for f0003
##     module_file, messages_file in get_tests_info('func_f0003', '.pyc')
##     class LintTestSubclass(LintTest):
##         module = module_file.replace('.pyc', '')
##         output = messages_file
##         depends = dependancies or None
##     tests.append(LintTestSubclass)
            
    class LintBuiltinModuleTest(LintTestUsingModule):
        output = 'messages/builtin_module.txt'
        module = 'sys'
        def test_functionality(self):
            self._test(['sys'])
    tests.append(LintBuiltinModuleTest)
    
    if not filter_rgx:
        # test all features are tested :)    
        tests.append(TestTests)

    return tests
Esempio n. 4
0
def make_tests(filter_rgx):
    """generate tests classes from test info

    return the list of generated test classes
    """
    if filter_rgx:
        is_to_run = re.compile(filter_rgx).search
    else:
        is_to_run = lambda x: 1
    tests = []
    for module_file, messages_file in get_tests_info('func_', '.py'):
        if not is_to_run(module_file):
            continue
        base = module_file.replace('func_', '').replace('.py', '')

        dependencies = get_tests_info(base, '.py')

        class LintTestUsingModuleTC(LintTestUsingModule):
            module = module_file.replace('.py', '')
            output = messages_file
            depends = dependencies or None
            tags = testlib.Tags(('generated', 'pylint_input_%s' % module))

        tests.append(LintTestUsingModuleTC)

        if MODULES_ONLY:
            continue

        class LintTestUsingFileTC(LintTestUsingFile):
            module = module_file.replace('.py', '')
            output = messages_file
            depends = dependencies or None
            tags = testlib.Tags(('generated', 'pylint_input_%s' % module))

        tests.append(LintTestUsingFileTC)

    if is_to_run('nonexistent'):
        tests.append(LintTestNonExistentModuleTC)
        if not MODULES_ONLY:
            tests.append(LintTestNonExistentFileTC)

    class LintBuiltinModuleTest(LintTestUsingModule):
        output = join(MSG_DIR, 'builtin_module.txt')
        module = 'sys'

        def test_functionality(self):
            self._test(['sys'])

    tests.append(LintBuiltinModuleTest)

    if not filter_rgx:
        # test all features are tested :)
        tests.append(TestTests)

    return tests
Esempio n. 5
0
def make_tests(filter_rgx):
    """generate tests classes from test info

    return the list of generated test classes
    """
    if filter_rgx:
        is_to_run = re.compile(filter_rgx).search
    else:
        is_to_run = lambda x: 1
    tests = []
    for module_file, messages_file in get_tests_info('func_', '.py'):
        if not is_to_run(module_file):
            continue
        base = module_file.replace('func_', '').replace('.py', '')

        dependencies = get_tests_info(base, '.py')

        class LintTestUsingModuleTC(LintTestUsingModule):
            module = module_file.replace('.py', '')
            output = messages_file
            depends = dependencies or None
            tags = testlib.Tags(('generated','pylint_input_%s' % module))
        tests.append(LintTestUsingModuleTC)

        if MODULES_ONLY:
            continue

        class LintTestUsingFileTC(LintTestUsingFile):
            module = module_file.replace('.py', '')
            output = messages_file
            depends = dependencies or None
            tags = testlib.Tags(('generated', 'pylint_input_%s' % module))
        tests.append(LintTestUsingFileTC)

    if is_to_run('nonexistent'):
        tests.append(LintTestNonExistentModuleTC)
        if not MODULES_ONLY:
            tests.append(LintTestNonExistentFileTC)

    class LintBuiltinModuleTest(LintTestUsingModule):
        output = join(MSG_DIR, 'builtin_module.txt')
        module = 'sys'
        def test_functionality(self):
            self._test(['sys'])
    tests.append(LintBuiltinModuleTest)

    if not filter_rgx:
        # test all features are tested :)
        tests.append(TestTests)

    return tests
Esempio n. 6
0
def make_tests(filter_rgx):
    """generate tests classes from test info

    return the list of generated test classes
    """
    if filter_rgx:
        is_to_run = re.compile(filter_rgx).search
    else:
        is_to_run = lambda x: 1
    tests = []
    for module_file, messages_file in get_tests_info('func_', '.py'):
        pyrestr = module_file.rsplit('_py', 1)[-1][:-3]
        if pyrestr.isdigit(): # '24', '25'...
            if sys.version_info < tuple([int(i) for i in pyrestr]):
                continue
        if pyrestr.startswith('_') and  pyrestr[1:].isdigit():
            # skip test for higher python versions
            if sys.version_info >= ( int(pyrestr[1]), int(pyrestr[2]) ):
                continue
        if not is_to_run(module_file):
            continue
        base = module_file.replace('func_', '').replace('.py', '')
        dependencies = get_tests_info(base, '.py')

        class LintTestUsingModuleTC(LintTestUsingModule):
            module = module_file.replace('.py', '')
            output = messages_file
            depends = dependencies or None
            tags = testlib.Tags(('generated','pylint_input_%s' % module))
        tests.append(LintTestUsingModuleTC)

        if MODULES_ONLY:
            continue

        class LintTestUsingFileTC(LintTestUsingFile):
            module = module_file.replace('.py', '')
            output = messages_file
            depends = dependencies or None
            tags = testlib.Tags(('generated', 'pylint_input_%s' % module))
        tests.append(LintTestUsingFileTC)

##     # special test for f0003
##     module_file, messages_file in get_tests_info('func_f0003', '.pyc')
##     class LintTestSubclass(LintTest):
##         module = module_file.replace('.pyc', '')
##         output = messages_file
##         depends = dependencies or None
##     tests.append(LintTestSubclass)

    if is_to_run('nonexistent'):
        tests.append(LintTestNonExistentModuleTC)
        if not MODULES_ONLY:
            tests.append(LintTestNonExistentFileTC)

    class LintBuiltinModuleTest(LintTestUsingModule):
        output = join(MSG_DIR, 'builtin_module.txt')
        module = 'sys'
        def test_functionality(self):
            self._test(['sys'])
    tests.append(LintBuiltinModuleTest)

    if not filter_rgx:
        # test all features are tested :)
        tests.append(TestTests)

    return tests
def make_tests(filter_rgx):
    """generate tests classes from test info
    
    return the list of generated test classes
    """
    if filter_rgx:
        is_to_run = re.compile(filter_rgx).search
    else:
        is_to_run = lambda x: 1
    tests = []
    for module_file, messages_file in get_tests_info(
            'func_', '.py') + [('nonexistant', 'messages/nonexistant.txt')]:
        # skip those tests with python >= 2.3 since py2.3 detects them by itself
        if PY23 and module_file == "func_unknown_encoding.py":  #"func_nonascii_noencoding.py"):
            continue
        pyrestr = module_file.rsplit('_py', 1)[-1][:-3]
        if pyrestr.isdigit():  # '24', '25'...
            if sys.version_info < tuple([int(i) for i in pyrestr]):
                continue
        if not is_to_run(module_file):
            continue
        base = module_file.replace('func_', '').replace('.py', '')
        dependencies = get_tests_info(base, '.py')

        class LintTestUsingModuleTC(LintTestUsingModule):
            module = module_file.replace('.py', '')
            output = messages_file
            depends = dependencies or None
            tags = testlib.Tags(('generated', 'pylint_input_%s' % module))

        tests.append(LintTestUsingModuleTC)

        if MODULES_ONLY:
            continue

        class LintTestUsingFileTC(LintTestUsingFile):
            module = module_file.replace('.py', '')
            output = exists(messages_file + '2') and (messages_file +
                                                      '2') or messages_file
            depends = dependencies or None
            tags = testlib.Tags(('generated', 'pylint_input_%s' % module))

        tests.append(LintTestUsingFileTC)


##     # special test for f0003
##     module_file, messages_file in get_tests_info('func_f0003', '.pyc')
##     class LintTestSubclass(LintTest):
##         module = module_file.replace('.pyc', '')
##         output = messages_file
##         depends = dependencies or None
##     tests.append(LintTestSubclass)

    class LintBuiltinModuleTest(LintTestUsingModule):
        output = 'messages/builtin_module.txt'
        module = 'sys'

        def test_functionality(self):
            self._test(['sys'])

    tests.append(LintBuiltinModuleTest)

    if not filter_rgx:
        # test all features are tested :)
        tests.append(TestTests)

    return tests