Merge lp:~larstiq/bzr/bzr-pypy into lp:bzr/2.5

Proposed by Wouter van Heyst
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merged at revision: 6473
Proposed branch: lp:~larstiq/bzr/bzr-pypy
Merge into: lp:bzr/2.5
Diff against target: 41 lines (+6/-3)
3 files modified
bzrlib/tests/blackbox/test_switch.py (+2/-2)
bzrlib/tests/test_remote.py (+1/-1)
doc/en/release-notes/bzr-2.5.txt (+3/-0)
To merge this branch: bzr merge lp:~larstiq/bzr/bzr-pypy
Reviewer Review Type Date Requested Status
Jelmer Vernooij (community) Approve
Review via email: mp+91428@code.launchpad.net

Commit message

Stop depending on the particular CPython ordering of dictionary keys when testing the result of BzrDir.get_branches.

Description of the change

Two tests that are interested in the result of a bzrdir.get_branches() call directly compare the keys() of this dictionary with a list. The sorting of that list is an implementation detail which is not the same under pypy.

The approach taken here was to just wrap the lists in set().

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 :

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

On 2/3/2012 1:57 PM, Wouter van Heyst wrote:
> Wouter van Heyst has proposed merging lp:~larstiq/bzr/bzr-pypy into
> lp:bzr/2.5.
>
> Requested reviews: bzr-core (bzr-core)
>
> For more details, see:
> https://code.launchpad.net/~larstiq/bzr/bzr-pypy/+merge/91428
>
> Two tests that are interested in the result of a
> bzrdir.get_branches() call directly compare the keys() of this
> dictionary with a list. The sorting of that list is an
> implementation detail which is not the same under pypy.
>
> The approach taken here was to just wrap the lists in set().

Just to mention I would usually wrap it in "sorted()" because it is
easier to read when something goes wrong.

John
=:->

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

iEYEARECAAYFAk8r3ZIACgkQJdeBCYSNAAMQgACeMbn9umEgD0yOM2sBCc8Rpx1R
7c4AnAytyfbQsGFapH1fy4LyOJZCVumy
=HEb7
-----END PGP SIGNATURE-----

Revision history for this message
Martin Pool (mbp) 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/blackbox/test_switch.py'
2--- bzrlib/tests/blackbox/test_switch.py 2012-01-19 12:36:22 +0000
3+++ bzrlib/tests/blackbox/test_switch.py 2012-02-03 12:56:18 +0000
4@@ -188,8 +188,8 @@
5 revid2 = tree.commit('rev2')
6 self.run_bzr(['switch', '-b', 'anotherbranch'])
7 self.assertEquals(
8- ['', 'anotherbranch'],
9- tree.branch.bzrdir.get_branches().keys())
10+ set(['', 'anotherbranch']),
11+ set(tree.branch.bzrdir.get_branches().keys()))
12
13 def test_switch_into_unrelated_colocated(self):
14 # Create a new colocated branch from an existing non-colocated branch.
15
16=== modified file 'bzrlib/tests/test_remote.py'
17--- bzrlib/tests/test_remote.py 2012-01-28 01:43:42 +0000
18+++ bzrlib/tests/test_remote.py 2012-02-03 12:56:18 +0000
19@@ -565,7 +565,7 @@
20 a_bzrdir = RemoteBzrDir(transport, RemoteBzrDirFormat(),
21 _client=client)
22 result = a_bzrdir.get_branches()
23- self.assertEquals(["", "foo"], result.keys())
24+ self.assertEquals(set(["", "foo"]), set(result.keys()))
25 self.assertEqual(
26 [('call_expecting_body', 'BzrDir.get_branches', ('quack/',)),
27 ('call', 'BzrDir.find_repositoryV3', ('quack/', )),
28
29=== modified file 'doc/en/release-notes/bzr-2.5.txt'
30--- doc/en/release-notes/bzr-2.5.txt 2012-02-03 09:26:21 +0000
31+++ doc/en/release-notes/bzr-2.5.txt 2012-02-03 12:56:18 +0000
32@@ -57,6 +57,9 @@
33 suite. This can include new facilities for writing tests, fixes to
34 spurious test failures and changes to the way things should be tested.
35
36+* Stop depending on the particular CPython ordering of dictionary keys
37+ when testing the result of BzrDir.get_branches.
38+ (Wouter van Heyst)
39
40 bzr 2.5b6
41 #########

Subscribers

People subscribed via source and target branches