Merge lp:~dobey/pay-service/pychecks into lp:pay-service

Proposed by dobey
Status: Merged
Approved by: Charles Kerr
Approved revision: 121
Merged at revision: 120
Proposed branch: lp:~dobey/pay-service/pychecks
Merge into: lp:pay-service
Prerequisite: lp:~timo-jyrinki/pay-service/stop_depending_on_transitional_packages
Diff against target: 222 lines (+57/-35)
6 files modified
CMakeLists.txt (+12/-0)
debian/control (+2/-0)
pay-ui/backend/tests/mock_click_server.py (+15/-17)
pay-ui/tests/autopilot/pay_ui/tests/__init__.py (+0/-2)
pay-ui/tests/autopilot/pay_ui/tests/mock_server.py (+6/-4)
tests/com_canonical_pay_store.py (+22/-12)
To merge this branch: bzr merge lp:~dobey/pay-service/pychecks
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
PS Jenkins bot continuous-integration Pending
Review via email: mp+295267@code.launchpad.net

Commit message

Add pep8 and pyflakes3 test rules.
Clean up the warnings from pep8 and pyflakes.

To post a comment you must log in.
lp:~dobey/pay-service/pychecks updated
120. By dobey

Fallback for pre-split pyflakes package.

121. By dobey

Fix typo in or dependency.

Revision history for this message
Charles Kerr (charlesk) wrote :

LGTM.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2016-03-08 23:25:11 +0000
3+++ CMakeLists.txt 2016-05-20 14:25:52 +0000
4@@ -109,3 +109,15 @@
5 TESTS libpay-iap-tests libpay-package-tests
6 FILTER ${filter-list}
7 )
8+
9+
10+file(RELATIVE_PATH RELATIVE_SRCDIR ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
11+##
12+## Python static checking
13+##
14+add_test(NAME pep8
15+ COMMAND pep8 ${RELATIVE_SRCDIR}
16+)
17+add_test(NAME pyflakes
18+ COMMAND pyflakes3 ${RELATIVE_SRCDIR}
19+)
20
21=== modified file 'debian/control'
22--- debian/control 2016-05-20 14:25:52 +0000
23+++ debian/control 2016-05-20 14:25:52 +0000
24@@ -26,7 +26,9 @@
25 libtrust-store-dev,
26 libubuntu-app-launch2-dev (>= 0.5),
27 libubuntuoneauth-2.0-dev,
28+ pep8,
29 pkg-config,
30+ pyflakes3 | pyflakes (>= 0.8.1-1),
31 python3-dbusmock,
32 qt5-default,
33 qtbase5-dev,
34
35=== modified file 'pay-ui/backend/tests/mock_click_server.py'
36--- pay-ui/backend/tests/mock_click_server.py 2016-03-08 21:28:56 +0000
37+++ pay-ui/backend/tests/mock_click_server.py 2016-05-20 14:25:52 +0000
38@@ -19,19 +19,17 @@
39 "description": "PayPal",
40 "id": "paypal",
41 "preferred": False,
42- "choices": [
43- {
44- "currencies": [
45- "USD",
46- "GBP",
47- "EUR"
48- ],
49- "id": 532,
50- "requires_interaction": False,
51- "preferred": False,
52- "description": "PayPal Preapproved Payment (exp. 2014-04-12)"
53- }
54- ]
55+ "choices": [{
56+ "currencies": [
57+ "USD",
58+ "GBP",
59+ "EUR"
60+ ],
61+ "id": 532,
62+ "requires_interaction": False,
63+ "preferred": False,
64+ "description": "PayPal Preapproved (exp. 2014-04-12)"
65+ }]
66 },
67 {
68 "description": "Credit or Debit Card",
69@@ -45,7 +43,7 @@
70 "id": 1767,
71 "requires_interaction": False,
72 "preferred": False,
73- "description": "**** **** **** 1111 (Visa, exp. 02/2015)"
74+ "description": "**** **** **** 1111 (X, exp. 02/2015)"
75 },
76 {
77 "currencies": [
78@@ -54,7 +52,7 @@
79 "id": 1726,
80 "requires_interaction": False,
81 "preferred": True,
82- "description": "**** **** **** 1111 (Visa, exp. 03/2015)"
83+ "description": "**** **** **** 1111 (X, exp. 03/2015)"
84 }
85 ]
86 }
87@@ -120,8 +118,8 @@
88
89 def do_POST(self):
90 """Respond to a POST request."""
91- #content = self.rfile.read(int(self.headers.get('content-length')))
92- #structure = json.loads(content.decode('utf-8'))
93+ # content = self.rfile.read(int(self.headers.get('content-length')))
94+ # structure = json.loads(content.decode('utf-8'))
95 self.do_GET()
96
97 def do_GET(self):
98
99=== modified file 'pay-ui/tests/autopilot/pay_ui/tests/__init__.py'
100--- pay-ui/tests/autopilot/pay_ui/tests/__init__.py 2016-03-10 21:12:52 +0000
101+++ pay-ui/tests/autopilot/pay_ui/tests/__init__.py 2016-05-20 14:25:52 +0000
102@@ -15,10 +15,8 @@
103 # along with this program. If not, see <http://www.gnu.org/licenses/>.
104
105 import fixtures
106-import json
107 import os
108 import shutil
109-import subprocess
110 import tempfile
111 import ubuntuuitoolkit as uitk
112
113
114=== modified file 'pay-ui/tests/autopilot/pay_ui/tests/mock_server.py'
115--- pay-ui/tests/autopilot/pay_ui/tests/mock_server.py 2016-03-08 21:28:56 +0000
116+++ pay-ui/tests/autopilot/pay_ui/tests/mock_server.py 2016-05-20 14:25:52 +0000
117@@ -22,7 +22,8 @@
118
119 html_success = """
120 <html>
121- <body bgcolor="green" onClick="window.location.assign('/paymentmethods/completeadd')">
122+ <body bgcolor="green"
123+ onClick="window.location.assign('/paymentmethods/completeadd')">
124 <h1>Placeholder for web interaction</h1>
125 <p>Click anywhere to proceed</p>
126 </body>
127@@ -31,7 +32,8 @@
128
129 html_cancel = """
130 <html>
131- <body bgcolor="red" onClick="window.location.assign('/api/2.0/click/cancelled')">
132+ <body bgcolor="red"
133+ onClick="window.location.assign('/api/2.0/click/cancelled')">
134 <h1>Placeholder for web interaction</h1>
135 <p>Click anywhere to cancel</p>
136 </body>
137@@ -233,8 +235,8 @@
138
139 def do_POST(self):
140 """Respond to a POST request."""
141- #content = self.rfile.read(int(self.headers.get('content-length')))
142- #structure = json.loads(content.decode('utf-8'))
143+ # content = self.rfile.read(int(self.headers.get('content-length')))
144+ # structure = json.loads(content.decode('utf-8'))
145 if self.path.find("purchases/") != -1:
146 self.response_buy_item()
147
148
149=== modified file 'tests/com_canonical_pay_store.py'
150--- tests/com_canonical_pay_store.py 2016-01-13 16:41:33 +0000
151+++ tests/com_canonical_pay_store.py 2016-05-20 14:25:52 +0000
152@@ -48,6 +48,7 @@
153 encoded.append('_{:02x}'.format(ord(ch)))
154 return ''.join(encoded)
155
156+
157 def build_store_path(package_name):
158 return STORE_PATH_PREFIX + '/' + encode_path_element(package_name)
159
160@@ -99,7 +100,7 @@
161
162 item = Item(sku)
163 store.items[sku] = item
164- store.set_item (store, sku, properties)
165+ store.set_item(store, sku, properties)
166
167
168 def store_set_item(store, sku, properties):
169@@ -158,7 +159,8 @@
170 elif sku != 'cancel':
171 item = store.items[sku]
172 item.set_property('state', 'approved')
173- item.set_property('purchase_id', dbus.UInt64(store.next_purchase_id))
174+ item.set_property('purchase_id',
175+ dbus.UInt64(store.next_purchase_id))
176 item.set_property('completed_timestamp', dbus.UInt64(time.time()))
177 store.next_purchase_id += 1
178 return store_get_item(store, sku)
179@@ -177,7 +179,8 @@
180 try:
181 item = store.items[sku]
182 if (item.bus_properties['state'] == 'purchased' and
183- item.bus_properties['refundable_until'] > dbus.UInt64(time.time())):
184+ (item.bus_properties['refundable_until'] >
185+ dbus.UInt64(time.time()))):
186 del store.items[sku]
187 return dbus.Dictionary({
188 'state': 'available',
189@@ -232,17 +235,24 @@
190 store.refund_item = store_refund_item
191 store.acknowledge_item = store_acknowledge_item
192 store.AddMethods(STORE_IFACE, [
193- ('AddItem', 'a{sv}', '', 'self.add_item(self, args[0])'),
194- ('SetItem', 'sa{sv}', '', 'self.set_item(self, args[0], args[1])'),
195- ('GetItem', 's', 'a{sv}', 'ret = self.get_item(self, args[0])'),
196- ('GetPurchasedItems', '', 'aa{sv}', 'ret = self.get_purchased_items(self)'),
197- ('PurchaseItem', 's', 'a{sv}', 'ret = self.purchase_item(self, args[0])'),
198- ('RefundItem', 's', 'a{sv}', 'ret = self.refund_item(self, args[0])'),
199- ('AcknowledgeItem', 's', 'a{sv}', 'ret = self.acknowledge_item(self, args[0])'),
200- ])
201+ ('AddItem', 'a{sv}', '',
202+ 'self.add_item(self, args[0])'),
203+ ('SetItem', 'sa{sv}', '',
204+ 'self.set_item(self, args[0], args[1])'),
205+ ('GetItem', 's', 'a{sv}',
206+ 'ret = self.get_item(self, args[0])'),
207+ ('GetPurchasedItems', '', 'aa{sv}',
208+ 'ret = self.get_purchased_items(self)'),
209+ ('PurchaseItem', 's', 'a{sv}',
210+ 'ret = self.purchase_item(self, args[0])'),
211+ ('RefundItem', 's', 'a{sv}',
212+ 'ret = self.refund_item(self, args[0])'),
213+ ('AcknowledgeItem', 's', 'a{sv}',
214+ 'ret = self.acknowledge_item(self, args[0])'),
215+ ])
216
217 for item in items:
218- store.add_item(store, item);
219+ store.add_item(store, item)
220
221
222 def main_get_stores(mock):

Subscribers

People subscribed via source and target branches

to all changes: