Merge lp:~jelmer/bzr/import-tariff-test-case into lp:bzr

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: no longer in the source branch.
Merged at revision: 5957
Proposed branch: lp:~jelmer/bzr/import-tariff-test-case
Merge into: lp:bzr
Diff against target: 47 lines (+10/-2)
2 files modified
bzrlib/tests/test_import_tariff.py (+6/-2)
doc/en/release-notes/bzr-2.4.txt (+4/-0)
To merge this branch: bzr merge lp:~jelmer/bzr/import-tariff-test-case
Reviewer Review Type Date Requested Status
Vincent Ladeuil Needs Fixing
Review via email: mp+63544@code.launchpad.net

Commit message

Split out ImportTariffTestCase so it can be used by plugins.

Description of the change

Split out ImportTariffTestCase so it can be used by plugins.

I wonder if bzrlib.tests.test_import_tariff is the right place for this; perhaps it should be moved to bzrlib.tests if it's going to be used by others?

To post a comment you must log in.
Revision history for this message
Vincent Ladeuil (vila) wrote :

[needsfixing] If ImportTariffTestCase is the preferred way to add such tests for plugins the doc string should stay there I think.

[thinking out loud] There are several places where this class may be defined: in test_import_tariff, in tests itself or in tests.fixtures.

tests itself sounds to broad for such focused tests and we don't have test classes in fixtures (and that may not be a good fit either).

I'll tend to leave the class in test_import_tariff.

review: Needs Fixing
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

On Mon, 2011-06-06 at 11:45 +0000, Vincent Ladeuil wrote:
> Review: Needs Fixing
> [needsfixing] If ImportTariffTestCase is the preferred way to add such tests for plugins the doc string should stay there I think.
Fixed.

> [thinking out loud] There are several places where this class may be defined: in test_import_tariff, in tests itself or in tests.fixtures.
>
> tests itself sounds to broad for such focused tests and we don't have test classes in fixtures (and that may not be a good fit either).
>
> I'll tend to leave the class in test_import_tariff.
Works for me, I'll leave it there.

Thanks for the review. :)

Cheers,

Jelmer

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/tests/test_import_tariff.py'
2--- bzrlib/tests/test_import_tariff.py 2011-06-01 10:03:46 +0000
3+++ bzrlib/tests/test_import_tariff.py 2011-06-06 12:01:25 +0000
4@@ -53,7 +53,7 @@
5 ]
6
7
8-class TestImportTariffs(TestCaseWithTransport):
9+class ImportTariffTestCase(TestCaseWithTransport):
10 """Check how many modules are loaded for some representative scenarios.
11
12 See the Testing Guide in the developer documentation for more explanation.
13@@ -72,7 +72,7 @@
14 for name in ('BZR_PLUGIN_PATH', 'BZR_DISABLE_PLUGINS', 'BZR_PLUGINS_AT'
15 ):
16 self.preserved_env_vars[name] = os.environ.get(name)
17- super(TestImportTariffs, self).setUp()
18+ super(ImportTariffTestCase, self).setUp()
19
20 def start_bzr_subprocess_with_import_check(self, args, stderr_file=None):
21 """Run a bzr process and capture the imports.
22@@ -141,6 +141,10 @@
23 self.finish_bzr_subprocess_with_import_check(process, args,
24 forbidden_imports)
25
26+
27+class TestImportTariffs(ImportTariffTestCase):
28+ """Basic import tariff tests for some common bzr commands"""
29+
30 def test_import_tariffs_working(self):
31 # check some guaranteed-true and false imports to be sure we're
32 # measuring correctly
33
34=== modified file 'doc/en/release-notes/bzr-2.4.txt'
35--- doc/en/release-notes/bzr-2.4.txt 2011-06-01 13:43:12 +0000
36+++ doc/en/release-notes/bzr-2.4.txt 2011-06-06 12:01:25 +0000
37@@ -93,6 +93,10 @@
38 suite. This can include new facilities for writing tests, fixes to
39 spurious test failures and changes to the way things should be tested.
40
41+* A `ImportTariffTestCase` base class has been added in
42+ ``bzrlib.tests.test_import_tariff``, which can be used for import tariff
43+ tests in plugins. (Jelmer Vernooij, #793465)
44+
45 * Fix deadlock in `TestImportTariffs.test_simple_serve` when stderr gets
46 more output than fits in the default buffer. This was happening on the
47 Windows buildslave, and could easily happen in other circumstances where