Merge lp:~gocept/landscape-client/py3-broker-ping into lp:~landscape/landscape-client/trunk

Proposed by Steffen Allner
Status: Merged
Approved by: Eric Snow
Approved revision: 979
Merged at revision: 982
Proposed branch: lp:~gocept/landscape-client/py3-broker-ping
Merge into: lp:~landscape/landscape-client/trunk
Prerequisite: lp:~gocept/landscape-client/py3-broker-exchange
Diff against target: 65 lines (+17/-3)
3 files modified
landscape/broker/ping.py (+6/-2)
landscape/reactor.py (+9/-1)
py3_ready_tests (+2/-0)
To merge this branch: bzr merge lp:~gocept/landscape-client/py3-broker-ping
Reviewer Review Type Date Requested Status
🤖 Landscape Builder test results Approve
Daniel Havlik (community) Approve
Eric Snow (community) Approve
Review via email: mp+320819@code.launchpad.net

Commit message

This MP brings landscape.broker.ping and its tests to Python 2/3 compatibility.

As a side effect the FakeReactor from landscape.reactor had to be ported too and is now also tested with Python 3.

Description of the change

This MP brings landscape.broker.ping and its tests to Python 2/3 compatibility.

As a side effect the FakeReactor from landscape.reactor had to be ported too and is now also tested with Python 3.

To post a comment you must log in.
Revision history for this message
🤖 Landscape Builder (landscape-builder) :
review: Abstain (executing tests)
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :

Command: TRIAL_ARGS=-j4 make check
Result: Success
Revno: 977
Branch: lp:~gocept/landscape-client/py3-broker-ping
Jenkins: https://ci.lscape.net/job/latch-test-xenial/3717/

review: Approve (test results)
Revision history for this message
🤖 Landscape Builder (landscape-builder) :
review: Abstain (executing tests)
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :

Command: TRIAL_ARGS=-j4 make check
Result: Success
Revno: 978
Branch: lp:~gocept/landscape-client/py3-broker-ping
Jenkins: https://ci.lscape.net/job/latch-test-xenial/3718/

review: Approve (test results)
Revision history for this message
Eric Snow (ericsnowcurrently) wrote :

Mostly LGTM. I have just one question.

review: Needs Information
Revision history for this message
Steffen Allner (sallner) wrote :

We need to land the broker.exchange branch first on /trunk to advance with this one.

Revision history for this message
Eric Snow (ericsnowcurrently) wrote :

LGTM

review: Approve
Revision history for this message
Daniel Havlik (nilo) wrote :

+1

review: Approve
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :

Attempt to merge into lp:landscape-client failed due to conflicts:

text conflict in py3_ready_tests

Revision history for this message
🤖 Landscape Builder (landscape-builder) :
review: Abstain (executing tests)
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :

Command: TRIAL_ARGS=-j4 make ci-check
Result: Success
Revno: 979
Branch: lp:~gocept/landscape-client/py3-broker-ping
Jenkins: https://ci.lscape.net/job/latch-test-xenial/3802/

review: Approve (test results)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'landscape/broker/ping.py'
2--- landscape/broker/ping.py 2017-03-17 09:26:45 +0000
3+++ landscape/broker/ping.py 2017-03-28 16:12:53 +0000
4@@ -33,7 +33,11 @@
5
6 """
7
8-import urllib
9+try:
10+ from urllib.parse import urlencode
11+except ImportError:
12+ from urllib import urlencode
13+
14 from logging import info
15
16 from twisted.python.failure import Failure
17@@ -65,7 +69,7 @@
18 """
19 if insecure_id is not None:
20 headers = {"Content-Type": "application/x-www-form-urlencoded"}
21- data = urllib.urlencode({"insecure_id": insecure_id})
22+ data = urlencode({"insecure_id": insecure_id})
23 page_deferred = defer.Deferred()
24
25 def errback(type, value, tb):
26
27=== modified file 'landscape/reactor.py'
28--- landscape/reactor.py 2017-01-05 09:07:23 +0000
29+++ landscape/reactor.py 2017-03-28 16:12:53 +0000
30@@ -296,9 +296,17 @@
31 def call_later(self, seconds, f, *args, **kwargs):
32 scheduled_time = self._current_time + seconds
33 call = (scheduled_time, f, args, kwargs)
34- bisect.insort_left(self._calls, call)
35+ self._insort_call(call)
36 return FakeReactorID(call)
37
38+ def _insort_call(self, call):
39+ # We want to insert the call in the appropriate time slot. A simple
40+ # bisect.insort_left() is not sufficient as the comparison of two
41+ # methods is not defined in Python 3.
42+ times = [c[0] for c in self._calls]
43+ index = bisect.bisect_left(times, call[0])
44+ self._calls.insert(index, call)
45+
46 def call_every(self, seconds, f, *args, **kwargs):
47
48 def fake():
49
50=== modified file 'py3_ready_tests'
51--- py3_ready_tests 2017-03-27 06:58:52 +0000
52+++ py3_ready_tests 2017-03-28 16:12:53 +0000
53@@ -4,10 +4,12 @@
54 landscape.package.tests
55
56
57+landscape.tests.test_reactor
58 landscape.tests.test_schema
59
60
61
62+landscape.broker.tests.test_ping
63
64 landscape.broker.tests.test_exchange
65 landscape.broker.tests.test_store

Subscribers

People subscribed via source and target branches

to all changes: