Merge lp:~jameinel/bzr/2.3-test-loader into lp:bzr

Proposed by John A Meinel
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merged at revision: 5409
Proposed branch: lp:~jameinel/bzr/2.3-test-loader
Merge into: lp:bzr
Diff against target: 52 lines (+21/-0)
3 files modified
NEWS (+4/-0)
bzrlib/tests/__init__.py (+4/-0)
bzrlib/tests/test_selftest.py (+13/-0)
To merge this branch: bzr merge lp:~jameinel/bzr/2.3-test-loader
Reviewer Review Type Date Requested Status
Jelmer Vernooij (community) Approve
Review via email: mp+34481@code.launchpad.net

Commit message

Restore TestSuite and TestLoader as attributes of bzrlib.tests

Description of the change

Recently Vincent was cleaning up some imports (as part of cleaning up leaking threads in tests.)

He ended up removing bzrlib.tests.TestSuite/TestLoader (because they were from the TestUtil module).

However, I think it is very useful for plugins, etc to be able to just grab the things they need for testing from one location.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve
Revision history for this message
John A Meinel (jameinel) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2010-09-01 18:06:19 +0000
3+++ NEWS 2010-09-02 20:21:00 +0000
4@@ -154,6 +154,10 @@
5 users to attach to their own processes by default.
6 (Martin Pool, #626679)
7
8+* Test classes like ``TestCase``, ``TestLoader``, and ``TestSuite`` should
9+ be available from ``bzrlib.tests.*``. They used to be, but were
10+ accidentally removed. (John Arbash Meinel, #627438)
11+
12 * ``Transport.stat`` on a symlink, including a transport pointing directly
13 to a symlink, now returns information about the symlink.
14 (Martin Pool)
15
16=== modified file 'bzrlib/tests/__init__.py'
17--- bzrlib/tests/__init__.py 2010-08-30 07:42:12 +0000
18+++ bzrlib/tests/__init__.py 2010-09-02 20:21:00 +0000
19@@ -135,6 +135,10 @@
20 SUBUNIT_SEEK_SET = 0
21 SUBUNIT_SEEK_CUR = 1
22
23+# These are intentionally brought into this namespace. That way plugins, etc
24+# can just "from bzrlib.tests import TestCase, TestLoader, etc"
25+TestSuite = TestUtil.TestSuite
26+TestLoader = TestUtil.TestLoader
27
28 class ExtendedTestResult(testtools.TextTestResult):
29 """Accepts, reports and accumulates the results of running tests.
30
31=== modified file 'bzrlib/tests/test_selftest.py'
32--- bzrlib/tests/test_selftest.py 2010-08-17 22:24:01 +0000
33+++ bzrlib/tests/test_selftest.py 2010-09-02 20:21:00 +0000
34@@ -122,6 +122,19 @@
35 self.failUnlessExists(filename)
36
37
38+class TestClassesAvailable(tests.TestCase):
39+ """As a convenience we expose Test* classes from bzrlib.tests"""
40+
41+ def test_test_case(self):
42+ from bzrlib.tests import TestCase
43+
44+ def test_test_loader(self):
45+ from bzrlib.tests import TestLoader
46+
47+ def test_test_suite(self):
48+ from bzrlib.tests import TestSuite
49+
50+
51 class TestTransportScenarios(tests.TestCase):
52 """A group of tests that test the transport implementation adaption core.
53