コード例 #1
0
    def testTwoCasesInGraph(self):
        res1 = self.makeResource()
        res2 = self.makeResource()

        set1 = frozenset([res1, res2])
        set2 = frozenset([res2])
        no_resources = frozenset()

        suite = testresources.OptimisingTestSuite()
        graph = suite._getGraph([no_resources, set1, set2])
        self.assertEqual(
            {
                no_resources: {
                    set1: 2,
                    set2: 1
                },
                set1: {
                    no_resources: 2,
                    set2: 1
                },
                set2: {
                    no_resources: 1,
                    set1: 1
                }
            }, graph)
コード例 #2
0
ファイル: __init__.py プロジェクト: 571451370/devstack_mitaka
def test_suite():
    packages = [
        'arguments',
        'commands',
        'repository',
        'ui',
    ]
    names = [
        'arguments',
        'commands',
        'matchers',
        'monkeypatch',
        'repository',
        'results',
        'setup',
        'stubpackage',
        'testcommand',
        'testr',
        'ui',
    ]
    module_names = ['testrepository.tests.test_' + name for name in names]
    loader = unittest.TestLoader()
    suite = loader.loadTestsFromNames(module_names)
    result = testresources.OptimisingTestSuite()
    result.addTests(generate_scenarios(suite))
    for pkgname in packages:
        pkg = __import__('testrepository.tests.' + pkgname, globals(),
                         locals(), ['test_suite'])
        result.addTests(generate_scenarios(pkg.test_suite()))
    return result
コード例 #3
0
    def load_tests(loader, found_tests, pattern):
        result = testresources.OptimisingTestSuite()
        result.addTests(found_tests)
        pkg_tests = loader.discover(start_dir=this_dir, pattern=pattern)
        result.addTests(testscenarios.generate_scenarios(pkg_tests))

        return result
コード例 #4
0
def load_tests(loader, standard_tests, pattern):
    # top level directory cached on loader instance
    this_dir = os.path.dirname(__file__)
    package_tests = loader.discover(start_dir=this_dir, pattern=pattern)
    result = testresources.OptimisingTestSuite()
    result.addTests(generate_scenarios(standard_tests))
    result.addTests(generate_scenarios(package_tests))
    return result
コード例 #5
0
ファイル: testlib_api.py プロジェクト: zhunzhong/neutron
def module_load_tests(loader, found_tests, pattern):
    """Apply OptimisingTestSuite on a per-module basis.

    FIXME(zzzeek): oslo.db provides this but the contract that
    "pattern" should be None no longer seems to behave as it used
    to at the module level, so this function needs to be added in this
    form.

    """

    result = testresources.OptimisingTestSuite()
    found_tests = testscenarios.load_tests_apply_scenarios(
        loader, found_tests, pattern)
    result.addTest(found_tests)
    return result
コード例 #6
0
    def load_tests(loader, found_tests, pattern):
        # pattern is None if the directive is placed within
        # a test module directly, as well as within certain test
        # discovery patterns

        if pattern is not None:
            pkg_tests = loader.discover(start_dir=this_dir, pattern=pattern)

        result = testresources.OptimisingTestSuite()
        found_tests = testscenarios.load_tests_apply_scenarios(
            loader, found_tests, pattern)
        result.addTest(found_tests)

        if pattern is not None:
            result.addTest(pkg_tests)
        return result
コード例 #7
0
def load_tests(loader, tests, pattern):
    return testresources.OptimisingTestSuite(tests)
コード例 #8
0
 def setUp(self):
     super(TestOptimisingTestSuite, self).setUp()
     self.optimising_suite = testresources.OptimisingTestSuite()
コード例 #9
0
 def sortTests(self, tests):
     suite = testresources.OptimisingTestSuite()
     suite.addTests(tests)
     suite.sortTests()
     return suite._tests
コード例 #10
0
 def testSingletonGraph(self):
     resource = self.makeResource()
     suite = testresources.OptimisingTestSuite()
     graph = suite._getGraph([frozenset()])
     self.assertEqual({frozenset(): {}}, graph)
コード例 #11
0
 def testEmptyGraph(self):
     suite = testresources.OptimisingTestSuite()
     graph = suite._getGraph([])
     self.assertEqual({}, graph)
コード例 #12
0
 def setUp(self):
     super(TestCostOfSwitching, self).setUp()
     self.suite = testresources.OptimisingTestSuite()
コード例 #13
0
 def load_tests(loader, found_tests, pattern):
     result = testresources.OptimisingTestSuite()
     result.addTests(testscenarios.generate_scenarios(found_tests))
     return result
コード例 #14
0
def load_tests(loader, tests, pattern):
    scenarios = testscenarios.generate_scenarios(tests)
    return testresources.OptimisingTestSuite(scenarios)
コード例 #15
0
def load_tests(loader, standard_tests, pattern):
    this_dir = os.path.dirname(__file__)
    package_tests = loader.discover(start_dir=this_dir, pattern=pattern)
    standard_tests.addTests(package_tests)
    return testresources.OptimisingTestSuite(standard_tests)
コード例 #16
0
ファイル: system.py プロジェクト: jaycee/basic-auth-service
def load_tests(loader, standard_tests, pattern):
    # top level directory cached on loader instance
    suite = testresources.OptimisingTestSuite()
    tests = loader.loadTestsFromTestCase(SystemTests)
    suite.addTests(tests)
    return suite