Merge ~cjwatson/launchpad:py3-dict-ordering into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 08fb6cf47ec4b1d07f9702910afa48def89eab6c
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:py3-dict-ordering
Merge into: launchpad:master
Diff against target: 226 lines (+39/-34)
8 files modified
lib/lp/bugs/doc/externalbugtracker-rt.txt (+4/-4)
lib/lp/bugs/tests/externalbugtracker.py (+2/-0)
lib/lp/services/statsd/tests/test_numbercruncher.py (+17/-16)
lib/lp/services/webapp/tests/test_errorlog.py (+6/-4)
lib/lp/soyuz/browser/tests/sourcepackage-views.txt (+1/-1)
lib/lp/soyuz/stories/webservice/xx-archive.txt (+6/-6)
lib/lp/soyuz/stories/webservice/xx-binary-package-publishing.txt (+2/-2)
lib/lp/soyuz/stories/webservice/xx-source-package-publishing.txt (+1/-1)
Reviewer Review Type Date Requested Status
Cristian Gonzalez (community) Approve
Review via email: mp+398377@code.launchpad.net

Commit message

Fix tests for different dict ordering in Python 3

To post a comment you must log in.
Revision history for this message
Cristian Gonzalez (cristiangsp) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/lib/lp/bugs/doc/externalbugtracker-rt.txt b/lib/lp/bugs/doc/externalbugtracker-rt.txt
index e54eef6..215cf9d 100644
--- a/lib/lp/bugs/doc/externalbugtracker-rt.txt
+++ b/lib/lp/bugs/doc/externalbugtracker-rt.txt
@@ -34,16 +34,16 @@ The default username and password for RT instances are 'guest' and
34specific credentials for will return the default credentials.34specific credentials for will return the default credentials.
3535
36 >>> rt_one = RequestTracker('http://foobar.com')36 >>> rt_one = RequestTracker('http://foobar.com')
37 >>> rt_one.credentials37 >>> print(pretty(rt_one.credentials))
38 {'user': 'guest', 'pass': 'guest'}38 {'pass': 'guest', 'user': 'guest'}
3939
40However, if the RT instance is one for which we have a username and40However, if the RT instance is one for which we have a username and
41password, those credentials will be retrieved from the Launchpad41password, those credentials will be retrieved from the Launchpad
42configuration files. rt.example.com is known to Launchpad.42configuration files. rt.example.com is known to Launchpad.
4343
44 >>> rt_two = RequestTracker('http://rt.example.com')44 >>> rt_two = RequestTracker('http://rt.example.com')
45 >>> rt_two.credentials45 >>> print(pretty(rt_two.credentials))
46 {'user': 'zaphod', 'pass': 'pangalacticgargleblaster'}46 {'pass': 'pangalacticgargleblaster', 'user': 'zaphod'}
4747
48== Status Conversion ==48== Status Conversion ==
4949
diff --git a/lib/lp/bugs/tests/externalbugtracker.py b/lib/lp/bugs/tests/externalbugtracker.py
index dfac073..b74e45c 100644
--- a/lib/lp/bugs/tests/externalbugtracker.py
+++ b/lib/lp/bugs/tests/externalbugtracker.py
@@ -13,6 +13,7 @@ from datetime import (
13 datetime,13 datetime,
14 timedelta,14 timedelta,
15 )15 )
16from operator import itemgetter
16import os17import os
17import random18import random
18import re19import re
@@ -1475,6 +1476,7 @@ class TestTracXMLRPCTransport(RequestsTransport):
1475 for comment in bug.comments:1476 for comment in bug.comments:
1476 if comment['id'] in comments:1477 if comment['id'] in comments:
1477 comments_to_return.append(comment)1478 comments_to_return.append(comment)
1479 comments_to_return.sort(key=itemgetter('id'))
14781480
1479 # For each of the missing ones, return a dict with a type of1481 # For each of the missing ones, return a dict with a type of
1480 # 'missing'.1482 # 'missing'.
diff --git a/lib/lp/services/statsd/tests/test_numbercruncher.py b/lib/lp/services/statsd/tests/test_numbercruncher.py
index 3433282..37f8bd3 100644
--- a/lib/lp/services/statsd/tests/test_numbercruncher.py
+++ b/lib/lp/services/statsd/tests/test_numbercruncher.py
@@ -14,6 +14,7 @@ from storm.store import Store
14from testtools.matchers import (14from testtools.matchers import (
15 Equals,15 Equals,
16 MatchesListwise,16 MatchesListwise,
17 MatchesSetwise,
17 Not,18 Not,
18 )19 )
19from testtools.twistedsupport import AsynchronousDeferredRunTest20from testtools.twistedsupport import AsynchronousDeferredRunTest
@@ -128,20 +129,20 @@ class TestNumberCruncher(StatsMixin, TestCaseWithFactory):
128 calls = [c[0] for c in self.stats_client.gauge.call_args_list129 calls = [c[0] for c in self.stats_client.gauge.call_args_list
129 if 'amd64' in c[0][0]]130 if 'amd64' in c[0][0]]
130 self.assertThat(131 self.assertThat(
131 calls, MatchesListwise(132 calls, MatchesSetwise(
132 [Equals((133 Equals((
133 'builders,status=disabled,arch=amd64,'134 'builders,status=disabled,arch=amd64,'
134 'virtualized=True,env=test', 0)),135 'virtualized=True,env=test', 0)),
135 Equals((136 Equals((
136 'builders,status=building,arch=amd64,'137 'builders,status=building,arch=amd64,'
137 'virtualized=True,env=test', 2)),138 'virtualized=True,env=test', 2)),
138 Equals((139 Equals((
139 'builders,status=idle,arch=amd64,'140 'builders,status=idle,arch=amd64,'
140 'virtualized=True,env=test', 4)),141 'virtualized=True,env=test', 4)),
141 Equals((142 Equals((
142 'builders,status=cleaning,arch=amd64,'143 'builders,status=cleaning,arch=amd64,'
143 'virtualized=True,env=test', 3))144 'virtualized=True,env=test', 3))
144 ]))145 ))
145146
146 def test_updateBuilderStats_error(self):147 def test_updateBuilderStats_error(self):
147 clock = task.Clock()148 clock = task.Clock()
@@ -172,11 +173,11 @@ class TestNumberCruncher(StatsMixin, TestCaseWithFactory):
172 self.assertEqual(2, self.stats_client.gauge.call_count)173 self.assertEqual(2, self.stats_client.gauge.call_count)
173 self.assertThat(174 self.assertThat(
174 [x[0] for x in self.stats_client.gauge.call_args_list],175 [x[0] for x in self.stats_client.gauge.call_args_list],
175 MatchesListwise(176 MatchesSetwise(
176 [Equals(('buildqueue,virtualized=True,arch={},env=test'.format(177 Equals(('buildqueue,virtualized=True,arch={},env=test'.format(
177 build.processor.name), 1)),178 build.processor.name), 1)),
178 Equals(('buildqueue,virtualized=False,arch=386,env=test', 1))179 Equals(('buildqueue,virtualized=False,arch=386,env=test', 1))
179 ]))180 ))
180181
181 def test_updateBuilderQueues_error(self):182 def test_updateBuilderQueues_error(self):
182 clock = task.Clock()183 clock = task.Clock()
diff --git a/lib/lp/services/webapp/tests/test_errorlog.py b/lib/lp/services/webapp/tests/test_errorlog.py
index d45be30..ff7c4a5 100644
--- a/lib/lp/services/webapp/tests/test_errorlog.py
+++ b/lib/lp/services/webapp/tests/test_errorlog.py
@@ -505,14 +505,15 @@ class TestErrorReportingUtility(TestCaseWithFactory):
505 """The error report should include the oops messages."""505 """The error report should include the oops messages."""
506 utility = ErrorReportingUtility()506 utility = ErrorReportingUtility()
507 utility._oops_config.publisher = None507 utility._oops_config.publisher = None
508 with utility.oopsMessage(dict(a='b', c='d')):508 message = {'a': 'b', 'c': 'd'}
509 with utility.oopsMessage(message):
509 try:510 try:
510 raise ArbitraryException('foo')511 raise ArbitraryException('foo')
511 except ArbitraryException:512 except ArbitraryException:
512 info = sys.exc_info()513 info = sys.exc_info()
513 oops = utility._oops_config.create(dict(exc_info=info))514 oops = utility._oops_config.create(dict(exc_info=info))
514 self.assertEqual(515 self.assertEqual(
515 {'<oops-message-0>': "{'a': 'b', 'c': 'd'}"},516 {'<oops-message-0>': str(message)},
516 oops['req_vars'])517 oops['req_vars'])
517518
518 def test__makeErrorReport_combines_request_and_error_vars(self):519 def test__makeErrorReport_combines_request_and_error_vars(self):
@@ -520,7 +521,8 @@ class TestErrorReportingUtility(TestCaseWithFactory):
520 utility = ErrorReportingUtility()521 utility = ErrorReportingUtility()
521 utility._oops_config.publisher = None522 utility._oops_config.publisher = None
522 request = ScriptRequest([('c', 'd')])523 request = ScriptRequest([('c', 'd')])
523 with utility.oopsMessage(dict(a='b')):524 message = {'a': 'b'}
525 with utility.oopsMessage(message):
524 try:526 try:
525 raise ArbitraryException('foo')527 raise ArbitraryException('foo')
526 except ArbitraryException:528 except ArbitraryException:
@@ -528,7 +530,7 @@ class TestErrorReportingUtility(TestCaseWithFactory):
528 oops = utility._oops_config.create(530 oops = utility._oops_config.create(
529 dict(exc_info=info, http_request=request))531 dict(exc_info=info, http_request=request))
530 self.assertEqual(532 self.assertEqual(
531 {'<oops-message-0>': "{'a': 'b'}", 'c': 'd'},533 {'<oops-message-0>': str(message), 'c': 'd'},
532 oops['req_vars'])534 oops['req_vars'])
533535
534 def test_filter_session_statement(self):536 def test_filter_session_statement(self):
diff --git a/lib/lp/soyuz/browser/tests/sourcepackage-views.txt b/lib/lp/soyuz/browser/tests/sourcepackage-views.txt
index 398630a..9a38b6c 100644
--- a/lib/lp/soyuz/browser/tests/sourcepackage-views.txt
+++ b/lib/lp/soyuz/browser/tests/sourcepackage-views.txt
@@ -61,7 +61,7 @@ architecturespecific attribute is hidden, i.e, this binary is
61architecture independent and we don't know at this point, that's why we61architecture independent and we don't know at this point, that's why we
62have only on binary.62have only on binary.
6363
64 >>> for bin_name, archs in firefox_view.binaries().items():64 >>> for bin_name, archs in sorted(firefox_view.binaries().items()):
65 ... print(bin_name, pretty(archs))65 ... print(bin_name, pretty(archs))
66 mozilla-firefox ['hppa', 'i386']66 mozilla-firefox ['hppa', 'i386']
67 mozilla-firefox-data ['hppa', 'i386']67 mozilla-firefox-data ['hppa', 'i386']
diff --git a/lib/lp/soyuz/stories/webservice/xx-archive.txt b/lib/lp/soyuz/stories/webservice/xx-archive.txt
index d613d25..17c4615 100644
--- a/lib/lp/soyuz/stories/webservice/xx-archive.txt
+++ b/lib/lp/soyuz/stories/webservice/xx-archive.txt
@@ -845,26 +845,26 @@ used and displayed via XHR.
845845
846 >>> build_counters = webservice.named_get(846 >>> build_counters = webservice.named_get(
847 ... ubuntu['main_archive_link'], 'getBuildCounters').jsonBody()847 ... ubuntu['main_archive_link'], 'getBuildCounters').jsonBody()
848 >>> for key, val in build_counters.items():848 >>> for key, val in sorted(build_counters.items()):
849 ... print("%s: %s" % (key, val))849 ... print("%s: %s" % (key, val))
850 failed: 5850 failed: 5
851 superseded: 3
852 total: 18
853 pending: 2851 pending: 2
854 succeeded: 8852 succeeded: 8
853 superseded: 3
854 total: 18
855855
856The optional param exclude_needsbuild is also provided:856The optional param exclude_needsbuild is also provided:
857857
858 >>> build_counters = webservice.named_get(858 >>> build_counters = webservice.named_get(
859 ... ubuntu['main_archive_link'], 'getBuildCounters',859 ... ubuntu['main_archive_link'], 'getBuildCounters',
860 ... include_needsbuild=False).jsonBody()860 ... include_needsbuild=False).jsonBody()
861 >>> for key, val in build_counters.items():861 >>> for key, val in sorted(build_counters.items()):
862 ... print("%s: %s" % (key, val))862 ... print("%s: %s" % (key, val))
863 failed: 5863 failed: 5
864 superseded: 3
865 total: 17
866 pending: 1864 pending: 1
867 succeeded: 8865 succeeded: 8
866 superseded: 3
867 total: 17
868868
869Getting published sources and binaries for an IArchive869Getting published sources and binaries for an IArchive
870~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~870~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/lib/lp/soyuz/stories/webservice/xx-binary-package-publishing.txt b/lib/lp/soyuz/stories/webservice/xx-binary-package-publishing.txt
index 72af5ec..af45f16 100644
--- a/lib/lp/soyuz/stories/webservice/xx-binary-package-publishing.txt
+++ b/lib/lp/soyuz/stories/webservice/xx-binary-package-publishing.txt
@@ -249,9 +249,9 @@ But other URLs result in a 404.
249249
250getDailyDownloadTotals returns a dict mapping dates to total counts.250getDailyDownloadTotals returns a dict mapping dates to total counts.
251251
252 >>> for key, value in webservice.named_get(252 >>> for key, value in sorted(webservice.named_get(
253 ... firefox['self_link'],253 ... firefox['self_link'],
254 ... 'getDailyDownloadTotals').jsonBody().items():254 ... 'getDailyDownloadTotals').jsonBody().items()):
255 ... print('%s: %d' % (key, value))255 ... print('%s: %d' % (key, value))
256 2010-02-21: 10256 2010-02-21: 10
257 2010-02-23: 8257 2010-02-23: 8
diff --git a/lib/lp/soyuz/stories/webservice/xx-source-package-publishing.txt b/lib/lp/soyuz/stories/webservice/xx-source-package-publishing.txt
index 0cfdd9c..761b7aa 100644
--- a/lib/lp/soyuz/stories/webservice/xx-source-package-publishing.txt
+++ b/lib/lp/soyuz/stories/webservice/xx-source-package-publishing.txt
@@ -350,7 +350,7 @@ service:
350Create a helper function to print the results:350Create a helper function to print the results:
351351
352 >>> def print_build_summaries(summaries):352 >>> def print_build_summaries(summaries):
353 ... for id, summary in summaries.items():353 ... for id, summary in sorted(summaries.items()):
354 ... arch_tags = [build['arch_tag'] for build in summary['builds']]354 ... arch_tags = [build['arch_tag'] for build in summary['builds']]
355 ... print("Source ID %s: %s (%s)" % (id, summary['status'],355 ... print("Source ID %s: %s (%s)" % (id, summary['status'],
356 ... pretty(arch_tags)))356 ... pretty(arch_tags)))

Subscribers

People subscribed via source and target branches

to status/vote changes: