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
=== modified file 'landscape/monitor/aptpreferences.py'
--- landscape/monitor/aptpreferences.py 2017-03-13 15:38:09 +0000
+++ landscape/monitor/aptpreferences.py 2017-03-30 08:24:31 +0000
@@ -46,7 +46,7 @@
46 if data == {}:46 if data == {}:
47 return None47 return None
4848
49 item_size_limit = self.size_limit / len(data.keys())49 item_size_limit = self.size_limit // len(data.keys())
50 for filename, contents in iteritems(data):50 for filename, contents in iteritems(data):
51 if len(filename) + len(contents) > item_size_limit:51 if len(filename) + len(contents) > item_size_limit:
52 truncated_contents_size = item_size_limit - len(filename)52 truncated_contents_size = item_size_limit - len(filename)
5353
=== modified file 'landscape/monitor/tests/test_aptpreferences.py'
--- landscape/monitor/tests/test_aptpreferences.py 2017-01-10 09:43:40 +0000
+++ landscape/monitor/tests/test_aptpreferences.py 2017-03-30 08:24:31 +0000
@@ -81,12 +81,12 @@
81 self.makeDir(path=preferences_directory)81 self.makeDir(path=preferences_directory)
82 limit = self.plugin.size_limit82 limit = self.plugin.size_limit
83 filename1 = self.makeFile(dirname=preferences_directory,83 filename1 = self.makeFile(dirname=preferences_directory,
84 content="a" * (limit / 2))84 content="a" * (limit // 2))
85 filename2 = self.makeFile(dirname=preferences_directory,85 filename2 = self.makeFile(dirname=preferences_directory,
86 content="b" * (limit / 2))86 content="b" * (limit // 2))
87 self.assertEqual(self.plugin.get_data(),87 self.assertEqual(self.plugin.get_data(),
88 {filename1: "a" * (limit / 2 - len(filename1)),88 {filename1: "a" * (limit // 2 - len(filename1)),
89 filename2: "b" * (limit / 2 - len(filename2))})89 filename2: "b" * (limit // 2 - len(filename2))})
9090
91 def test_exchange_without_apt_preferences_data(self):91 def test_exchange_without_apt_preferences_data(self):
92 """92 """
9393
=== modified file 'py3_ready_tests'
--- py3_ready_tests 2017-03-30 08:24:31 +0000
+++ py3_ready_tests 2017-03-30 08:24:31 +0000
@@ -15,3 +15,4 @@
15landscape.monitor.tests.test_networkdevice15landscape.monitor.tests.test_networkdevice
16landscape.monitor.tests.test_networkactivity16landscape.monitor.tests.test_networkactivity
17landscape.monitor.tests.test_packagemonitor17landscape.monitor.tests.test_packagemonitor
18landscape.monitor.tests.test_aptpreferences

Subscribers

People subscribed via source and target branches

to all changes: