1# Testoob, Python Testing Out Of (The) Box
2# Copyright (C) 2005-2006 The Testoob Team
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16"Run tests in processes"
17
18from baserunner import BaseRunner
19
20class ProcessedRunner(BaseRunner):
21    "Run tests using fork in different processes."
22    def __init__(self, max_processes=1):
23        from processed_helper import ProcessedRunnerHelper
24        BaseRunner.__init__(self)
25        self._helper = ProcessedRunnerHelper(max_processes)
26
27    def run(self, fixture):
28        BaseRunner.run(self, fixture)
29        self._helper.register_fixture(fixture)
30
31    def done(self):
32        self._helper.start(self.reporter)
33        BaseRunner.done(self)
34