Merge lp:~vila/bzr/783472-wt-scenarios into lp:bzr

Proposed by Vincent Ladeuil
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: no longer in the source branch.
Merged at revision: 5875
Proposed branch: lp:~vila/bzr/783472-wt-scenarios
Merge into: lp:bzr
Diff against target: 64 lines (+27/-7)
2 files modified
bzrlib/tests/per_workingtree/__init__.py (+24/-7)
doc/en/release-notes/bzr-2.4.txt (+3/-0)
To merge this branch: bzr merge lp:~vila/bzr/783472-wt-scenarios
Reviewer Review Type Date Requested Status
bzr-core Pending
Review via email: mp+61117@code.launchpad.net

Commit message

Add an helper for per_workingtree scenarios that plugins can reuse

Description of the change

I used to use wt_scenarios in per_workingtree in one of my plugins.

This disappeared recently (the helper wasn't particularly well documented to be honest) and I didn't realize that until recently.

This mp re-introduce the helper.

As mentioned in the bug, this another valid use case to reuse tests and it would be nice to keep it in mind for our other parameterized tests (I don't intend to fix that pro-actively though).

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

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/16/2011 03:42 PM, Vincent Ladeuil wrote:
> Vincent Ladeuil has proposed merging lp:~vila/bzr/783472-wt-scenarios into lp:bzr.
>
> Requested reviews:
> bzr-core (bzr-core)
> Related bugs:
> Bug #783472 in Bazaar: "per_working_tree should provide reusable scenarios"
> https://bugs.launchpad.net/bzr/+bug/783472
>
> For more details, see:
> https://code.launchpad.net/~vila/bzr/783472-wt-scenarios/+merge/61117
>
> I used to use wt_scenarios in per_workingtree in one of my plugins.
>
> This disappeared recently (the helper wasn't particularly well documented to be honest) and I didn't realize that until recently.
>
> This mp re-introduce the helper.
>
> As mentioned in the bug, this another valid use case to reuse tests and it would be nice to keep it in mind for our other parameterized tests (I don't intend to fix that pro-actively though).

I'm fine re-introducing this. But if you actually depend on it
externally, it sounds like something that needs a test case so that we
don't delete it without letting people know.

John
=:->

 review:needsfixing

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk3RMCIACgkQJdeBCYSNAAOapACfTfwK7UE4Qbk2cjJ3ccUOMBWh
PqgAoJi46jYJ5MjYSOkPz09PD7ADng75
=UcnS
-----END PGP SIGNATURE-----

Revision history for this message
Vincent Ladeuil (vila) 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 'bzrlib/tests/per_workingtree/__init__.py'
2--- bzrlib/tests/per_workingtree/__init__.py 2011-05-04 11:15:37 +0000
3+++ bzrlib/tests/per_workingtree/__init__.py 2011-05-16 15:31:01 +0000
4@@ -50,6 +50,22 @@
5 }
6
7
8+def wt_scenarios():
9+ """Returns the scenarios for all registered working trees.
10+
11+ This can used by plugins that want to define tests against these working
12+ trees.
13+ """
14+ scenarios = make_scenarios(
15+ tests.default_transport,
16+ # None here will cause a readonly decorator to be created
17+ # by the TestCaseWithTransport.get_readonly_transport method.
18+ None,
19+ workingtree.format_registry._get_all()
20+ )
21+ return scenarios
22+
23+
24 class TestCaseWithWorkingTree(per_controldir.TestCaseWithControlDir):
25
26 def make_branch_and_tree(self, relpath, format=None):
27@@ -114,15 +130,16 @@
28 'bzrlib.tests.per_workingtree.test_' + name for
29 name in test_names]
30
31- scenarios = make_scenarios(
32- tests.default_transport,
33- # None here will cause a readonly decorator to be created
34- # by the TestCaseWithTransport.get_readonly_transport method.
35- None,
36- workingtree.format_registry._get_all()
37- )
38+ scenarios = wt_scenarios()
39
40 # add the tests for the sub modules
41 return tests.multiply_tests(
42 loader.loadTestsFromModuleNames(test_workingtree_implementations),
43 scenarios, standard_tests)
44+
45+
46+class TestWtScenarios(tests.TestCase):
47+
48+ def test_protect_wt_scenarios(self):
49+ # Just make sure we don't accidentally delete the helper again
50+ scenarios = wt_scenarios()
51
52=== modified file 'doc/en/release-notes/bzr-2.4.txt'
53--- doc/en/release-notes/bzr-2.4.txt 2011-05-16 11:17:40 +0000
54+++ doc/en/release-notes/bzr-2.4.txt 2011-05-16 15:31:01 +0000
55@@ -119,6 +119,9 @@
56 suite. This can include new facilities for writing tests, fixes to
57 spurious test failures and changes to the way things should be tested.
58
59+* Make it easier for plugins to reuse the per_workingtree scenarios by
60+ restoring the wt_scenarios helper that was accidentally deleted.
61+ (Vincent Ladeuil, #783472)
62
63 bzr 2.4b2
64 #########