コード例 #1
0
class WorkerProtocol(AMP):
    """
    The worker-side trial distributed protocol.
    """
    def __init__(self, forceGarbageCollection=False):
        self._loader = TestLoader()
        self._result = WorkerReporter(self)
        self._forceGarbageCollection = forceGarbageCollection

    def run(self, testCase):
        """
        Run a test case by name.
        """
        case = self._loader.loadByName(testCase)
        suite = TrialSuite([case], self._forceGarbageCollection)
        suite.run(self._result)
        return {'success': True}

    workercommands.Run.responder(run)

    def start(self, directory):
        """
        Set up the worker, moving into given directory for tests to run in
        them.
        """
        os.chdir(directory)
        return {'success': True}

    workercommands.Start.responder(start)
コード例 #2
0
ファイル: worker.py プロジェクト: 0004c/VTK
class WorkerProtocol(AMP):
    """
    The worker-side trial distributed protocol.
    """

    def __init__(self, forceGarbageCollection=False):
        self._loader = TestLoader()
        self._result = WorkerReporter(self)
        self._forceGarbageCollection = forceGarbageCollection


    def run(self, testCase):
        """
        Run a test case by name.
        """
        case = self._loader.loadByName(testCase)
        suite = TrialSuite([case], self._forceGarbageCollection)
        suite.run(self._result)
        return {'success': True}

    workercommands.Run.responder(run)


    def start(self, directory):
        """
        Set up the worker, moving into given directory for tests to run in
        them.
        """
        os.chdir(directory)
        return {'success': True}

    workercommands.Start.responder(start)
コード例 #3
0
ファイル: flaky.py プロジェクト: petercolesdc/flocker
def _load_tests(name):
    """
    Find all the tests under ``name``.

    :param str name: The fully-qualified Python name of an object.
    :return: A ``TestSuite`` or ``TestCase`` containing all the tests.
    """
    loader = TestLoader()
    return loader.loadByName(name, recurse=True)
コード例 #4
0
ファイル: flaky.py プロジェクト: petercolesdc/flocker
def _load_tests(name):
    """
    Find all the tests under ``name``.

    :param str name: The fully-qualified Python name of an object.
    :return: A ``TestSuite`` or ``TestCase`` containing all the tests.
    """
    loader = TestLoader()
    return loader.loadByName(name, recurse=True)
コード例 #5
0
ファイル: test_meta.py プロジェクト: 332054781/flocker
def get_tests_for(python_name):
    """
    Find all tests for the given ``python_name``.

    :param python_name: Either directory in ``REPOSITORY`` or a Python FQPN
        importable from ``REPOSITORY``.
    :return: PSet of test names.
    """
    def _extract_ids(t):
        if isinstance(t, TestSuite):
            result = pset()
            for sub_tests in t:
                result = result | _extract_ids(sub_tests)
            return result
        else:
            return pset([t.id()])

    loader = TestLoader()
    tests = loader.loadByName(python_name, recurse=True)
    return _extract_ids(tests)
コード例 #6
0
def get_tests_for(python_name):
    """
    Find all tests for the given ``python_name``.

    :param python_name: Either directory in ``REPOSITORY`` or a Python FQPN
        importable from ``REPOSITORY``.
    :return: PSet of test names.
    """
    def _extract_ids(t):
        if isinstance(t, TestSuite):
            result = pset()
            for sub_tests in t:
                result = result | _extract_ids(sub_tests)
            return result
        else:
            return pset([t.id()])

    loader = TestLoader()
    tests = loader.loadByName(python_name, recurse=True)
    return _extract_ids(tests)
コード例 #7
0
ファイル: runtests.py プロジェクト: kustomzone/PyOfWave
def runtests(root_dir='pyofwave'):
    runner = TrialRunner(TreeReporter)
    loader = TestLoader()
    failures = runner.run(loader.loadByName(root_dir, recurse=True))
    sys.exit(failures)
コード例 #8
0
ファイル: runtests.py プロジェクト: pyofwave/PyOfWave
def runtests(root_dir='pyofwave'):
    runner = TrialRunner(TreeReporter)
    loader = TestLoader()
    failures = runner.run(loader.loadByName(root_dir, recurse=True))
    sys.exit(failures)