コード例 #1
0
ファイル: setup.py プロジェクト: Phoul/pycryptopp
 def run(self):
     self.setup_path()
     loader = ScanningLoader()
     test = loader.loadTestsFromName(self.test_suite)
     runner = unittest.TextTestRunner(verbosity=2)
     result = runner.run(test)
     sys.exit(not result.wasSuccessful())
コード例 #2
0
 def run(self):
     self.setup_path()
     loader = ScanningLoader()
     test = loader.loadTestsFromName(self.test_suite)
     runner = unittest.TextTestRunner(verbosity=2)
     result = runner.run(test)
     sys.exit(not result.wasSuccessful())
コード例 #3
0
ファイル: loader.py プロジェクト: dhain/replify
 def loadTestsFromNames(self, names, module=None):
     suite = ScanningLoader().loadTestsFromNames(names, module)
     for loader, name, ispkg in walk_packages(
         replify.__path__,
         replify.__name__ + '.'
     ):
         if ispkg:
             continue
         try:
             docsuite = DocTestSuite(name)
         except ValueError as err:
             if err.args[1] not in ['has no tests', 'has no docstrings']:
                 raise
             continue
         suite.addTests(docsuite)
     for dirpath, dirnames, filenames in os.walk(DOC_PATH):
         for i, d in reverse_iter(dirnames):
             if d.startswith('_'):
                 del dirnames[i]
         for f in filenames:
             if not f.endswith('.rst'):
                 continue
             docsuite = DocFileSuite(
                 os.path.join(dirpath, f), module_relative=False)
             suite.addTests(docsuite)
     return suite
コード例 #4
0
ファイル: loader.py プロジェクト: dhain/potpy
 def loadTestsFromNames(self, names, module=None):
     suite = ScanningLoader().loadTestsFromNames(names, module)
     for loader, name, ispkg in walk_packages(potpy.__path__, potpy.__name__ + '.'):
         if ispkg:
             continue
         try:
             docsuite = DocTestSuite(name)
         except ValueError, err:
             if err.args[1] != 'has no tests':
                 raise
             continue
         suite.addTests(docsuite)
コード例 #5
0
ファイル: shared_setup.py プロジェクト: ocaisa/vsc-base
    def loadTestsFromModule(self, module):
        """
        Support test module and function name based filtering
        """
        testsuites = ScanningLoader.loadTestsFromModule(self, module)

        test_filter = getattr(__builtin__,'__test_filter')

        res = testsuites

        if test_filter['module'] is not None:
            name = module.__name__
            if name in test_filter['allowmods']:
                # a parent name space
                pass
            elif re.search(test_filter['module'], name):
                if test_filter['function'] is not None:
                    res = filter_testsuites(testsuites)
                # add parents (and module itself)
                pms = name.split('.')
                for pm_idx in range(len(pms)):
                    pm = '.'.join(pms[:pm_idx])
                    if not pm in test_filter['allowmods']:
                        test_filter['allowmods'].append(pm)
            else:
                res = type(testsuites)()

        return res
コード例 #6
0
    def collect(self):
        for spec in self.spec_list:
            if ":" in spec:
                modname, funcname = spec.split(":")
                mod = __import__(modname, None, None, ["doc"])
                func = getattr(mod, funcname)
                suites = func()
            else:
                mod = __import__(spec, None, None, ["doc"])
                from setuptools.command.test import ScanningLoader

                scanningLoader = ScanningLoader()
                suites = scanningLoader.loadTestsFromModule(mod)
            for item in suites:
                if isinstance(item, unittest.TestSuite):
                    yield UnitTestSuite("", parent=self, suite=item)
コード例 #7
0
 def loadTestsFromNames(self, names, module=None):
     suite = ScanningLoader().loadTestsFromNames(names, module)
     for loader, name, ispkg in walk_packages(replify.__path__,
                                              replify.__name__ + '.'):
         if ispkg:
             continue
         try:
             docsuite = DocTestSuite(name)
         except ValueError as err:
             if err.args[1] not in ['has no tests', 'has no docstrings']:
                 raise
             continue
         suite.addTests(docsuite)
     for dirpath, dirnames, filenames in os.walk(DOC_PATH):
         for i, d in reverse_iter(dirnames):
             if d.startswith('_'):
                 del dirnames[i]
         for f in filenames:
             if not f.endswith('.rst'):
                 continue
             docsuite = DocFileSuite(os.path.join(dirpath, f),
                                     module_relative=False)
             suite.addTests(docsuite)
     return suite
コード例 #8
0
ファイル: runtests.py プロジェクト: rcgee/oq-hazardlib
 def loadTestsFromNames(self, suitename, module=None):
     names = suitename[0].split(',')
     return ScanningLoader().loadTestsFromNames(names, module)
コード例 #9
0
 def loadTestsFromModule(self, module):
     return skipLayers(ScanningLoader.loadTestsFromModule(self, module))
コード例 #10
0
ファイル: __init__.py プロジェクト: srwiser/oplogutils
 def loadTestsFromNames(self, *args, **kwargs):
     s = ScanningLoader.loadTestsFromNames(self, *args, **kwargs)
     wrapper = TestSuite()
     wrapper.addTests(s)
     return wrapper
コード例 #11
0
 def loadTestsFromNames(self, testNames, module):
     return skipLayers(
         ScanningLoader.loadTestsFromNames(self, testNames, module))
コード例 #12
0
ファイル: __init__.py プロジェクト: joelimome/oplogutils
 def loadTestsFromNames(self, *args, **kwargs):
     s = ScanningLoader.loadTestsFromNames(self, *args, **kwargs)
     wrapper = TestSuite()
     wrapper.addTests(s)
     return wrapper
コード例 #13
0
ファイル: test.py プロジェクト: mwick83/glasgow
# Top-level interface to run the Glasgow tests.

import unittest
from setuptools.command.test import ScanningLoader

if __name__ == "__main__":
    unittest.main(module="glasgow", testLoader=ScanningLoader())
コード例 #14
0
 def loadTestsFromNames(self, testNames, module):
     return skipLayers(
         ScanningLoader.loadTestsFromNames(self, testNames, module))