1
# Copyright (c) 2009 testtools developers. See LICENSE for details.
3
"""Test ConcurrentTestSuite and related things."""
10
from testtools import (
15
from testtools.matchers import (
18
from testtools.tests.helpers import LoggingResult
21
class TestConcurrentTestSuiteRun(TestCase):
23
def test_trivial(self):
25
result = LoggingResult(log)
26
class Sample(TestCase):
30
def test_method1(self):
32
def test_method2(self):
34
test1 = Sample('test_method1')
35
test2 = Sample('test_method2')
36
original_suite = unittest.TestSuite([test1, test2])
37
suite = ConcurrentTestSuite(original_suite, self.split_suite)
39
# 0 is the timestamp for the first test starting.
42
self.assertIsInstance(test1, Sample)
43
self.assertIsInstance(test2, Sample)
44
self.assertNotEqual(test1.id(), test2.id())
46
def split_suite(self, suite):
47
tests = list(iterate_tests(suite))
48
return tests[0], tests[1]
52
from unittest import TestLoader
53
return TestLoader().loadTestsFromName(__name__)