Merge lp:~gocept/landscape-client/py3-monitor-aptpreferences into lp:~landscape/landscape-client/trunk

Proposed by Steffen Allner
Status: Merged
Approved by: Eric Snow
Approved revision: 998
Merged at revision: 995
Proposed branch: lp:~gocept/landscape-client/py3-monitor-aptpreferences
Merge into: lp:~landscape/landscape-client/trunk
Prerequisite: lp:~gocept/landscape-client/py3-monitor-packagemonitor
Diff against target: 42 lines (+6/-5)
3 files modified
landscape/monitor/aptpreferences.py (+1/-1)
landscape/monitor/tests/test_aptpreferences.py (+4/-4)
py3_ready_tests (+1/-0)
To merge this branch: bzr merge lp:~gocept/landscape-client/py3-monitor-aptpreferences
Reviewer Review Type Date Requested Status
Eric Snow (community) Approve
Daniel Havlik (community) Approve
Geoff Teale (community) Approve
🤖 Landscape Builder test results Approve
Review via email: mp+321418@code.launchpad.net

Commit message

This is the Py3 port of landscape.monitor.aptpreferences.

It fixes the Py3 change in floor division operator.

Description of the change

This MP fixes the landscape.monitor.aptpreferences module and its tests by using floor division explicitly as wee need the division result for a multiplication with a string and as index.

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 ci-check
Result: Success
Revno: 998
Branch: lp:~gocept/landscape-client/py3-monitor-aptpreferences
Jenkins: https://ci.lscape.net/job/latch-test-xenial/3821/

review: Approve (test results)
Revision history for this message
Geoff Teale (tealeg) wrote :

+1

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

+1

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

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'landscape/monitor/aptpreferences.py'
2--- landscape/monitor/aptpreferences.py 2017-03-13 15:38:09 +0000
3+++ landscape/monitor/aptpreferences.py 2017-03-30 08:24:31 +0000
4@@ -46,7 +46,7 @@
5 if data == {}:
6 return None
7
8- item_size_limit = self.size_limit / len(data.keys())
9+ item_size_limit = self.size_limit // len(data.keys())
10 for filename, contents in iteritems(data):
11 if len(filename) + len(contents) > item_size_limit:
12 truncated_contents_size = item_size_limit - len(filename)
13
14=== modified file 'landscape/monitor/tests/test_aptpreferences.py'
15--- landscape/monitor/tests/test_aptpreferences.py 2017-01-10 09:43:40 +0000
16+++ landscape/monitor/tests/test_aptpreferences.py 2017-03-30 08:24:31 +0000
17@@ -81,12 +81,12 @@
18 self.makeDir(path=preferences_directory)
19 limit = self.plugin.size_limit
20 filename1 = self.makeFile(dirname=preferences_directory,
21- content="a" * (limit / 2))
22+ content="a" * (limit // 2))
23 filename2 = self.makeFile(dirname=preferences_directory,
24- content="b" * (limit / 2))
25+ content="b" * (limit // 2))
26 self.assertEqual(self.plugin.get_data(),
27- {filename1: "a" * (limit / 2 - len(filename1)),
28- filename2: "b" * (limit / 2 - len(filename2))})
29+ {filename1: "a" * (limit // 2 - len(filename1)),
30+ filename2: "b" * (limit // 2 - len(filename2))})
31
32 def test_exchange_without_apt_preferences_data(self):
33 """
34
35=== modified file 'py3_ready_tests'
36--- py3_ready_tests 2017-03-30 08:24:31 +0000
37+++ py3_ready_tests 2017-03-30 08:24:31 +0000
38@@ -15,3 +15,4 @@
39 landscape.monitor.tests.test_networkdevice
40 landscape.monitor.tests.test_networkactivity
41 landscape.monitor.tests.test_packagemonitor
42+landscape.monitor.tests.test_aptpreferences

Subscribers

People subscribed via source and target branches

to all changes: