Merge lp:~cjwatson/storm/py3-exceptions into lp:storm
- py3-exceptions
- Merge into trunk
Proposed by
Colin Watson
Status: | Merged |
---|---|
Merged at revision: | 491 |
Proposed branch: | lp:~cjwatson/storm/py3-exceptions |
Merge into: | lp:storm |
Prerequisite: | lp:~cjwatson/storm/tox |
Diff against target: |
391 lines (+37/-37) 15 files modified
storm/__init__.py (+1/-1) storm/database.py (+5/-5) storm/databases/sqlite.py (+1/-1) storm/schema/schema.py (+1/-1) storm/schema/sharding.py (+1/-1) storm/twisted/transact.py (+1/-1) tests/databases/base.py (+4/-4) tests/databases/postgres.py (+2/-2) tests/databases/sqlite.py (+2/-2) tests/mocker.py (+7/-7) tests/schema/patch.py (+4/-4) tests/store/base.py (+1/-1) tests/tracer.py (+2/-2) tests/variables.py (+4/-4) tests/zope/zstorm.py (+1/-1) |
To merge this branch: | bzr merge lp:~cjwatson/storm/py3-exceptions |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Simon Poirier (community) | Approve | ||
Review via email: mp+368143@code.launchpad.net |
Commit message
Use Python 3-friendly "except" syntax.
Description of the change
This is a tiny subset of Thiago Bellini's work in https:/
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'storm/__init__.py' | |||
2 | --- storm/__init__.py 2013-06-28 09:56:58 +0000 | |||
3 | +++ storm/__init__.py 2019-05-30 13:43:46 +0000 | |||
4 | @@ -53,6 +53,6 @@ | |||
5 | 53 | try: | 53 | try: |
6 | 54 | from storm import cextensions | 54 | from storm import cextensions |
7 | 55 | has_cextensions = True | 55 | has_cextensions = True |
9 | 56 | except ImportError, e: | 56 | except ImportError as e: |
10 | 57 | if "cextensions" not in str(e): | 57 | if "cextensions" not in str(e): |
11 | 58 | raise | 58 | raise |
12 | 59 | 59 | ||
13 | === modified file 'storm/database.py' | |||
14 | --- storm/database.py 2015-06-15 13:42:07 +0000 | |||
15 | +++ storm/database.py 2019-05-30 13:43:46 +0000 | |||
16 | @@ -318,7 +318,7 @@ | |||
17 | 318 | self._raw_connection.tpc_rollback() | 318 | self._raw_connection.tpc_rollback() |
18 | 319 | else: | 319 | else: |
19 | 320 | self._raw_connection.rollback() | 320 | self._raw_connection.rollback() |
21 | 321 | except Error, exc: | 321 | except Error as exc: |
22 | 322 | if self.is_disconnection_error(exc): | 322 | if self.is_disconnection_error(exc): |
23 | 323 | self._raw_connection = None | 323 | self._raw_connection = None |
24 | 324 | self._state = STATE_RECONNECT | 324 | self._state = STATE_RECONNECT |
25 | @@ -386,7 +386,7 @@ | |||
26 | 386 | """Complete the statement execution, along with result reports.""" | 386 | """Complete the statement execution, along with result reports.""" |
27 | 387 | try: | 387 | try: |
28 | 388 | self._check_disconnect(raw_cursor.execute, *args) | 388 | self._check_disconnect(raw_cursor.execute, *args) |
30 | 389 | except Exception, error: | 389 | except Exception as error: |
31 | 390 | self._check_disconnect( | 390 | self._check_disconnect( |
32 | 391 | trace, "connection_raw_execute_error", self, raw_cursor, | 391 | trace, "connection_raw_execute_error", self, raw_cursor, |
33 | 392 | statement, params or (), error) | 392 | statement, params or (), error) |
34 | @@ -402,7 +402,7 @@ | |||
35 | 402 | self._check_disconnect( | 402 | self._check_disconnect( |
36 | 403 | trace, "connection_raw_execute", self, raw_cursor, | 403 | trace, "connection_raw_execute", self, raw_cursor, |
37 | 404 | statement, params or ()) | 404 | statement, params or ()) |
39 | 405 | except Exception, error: | 405 | except Exception as error: |
40 | 406 | self._check_disconnect( | 406 | self._check_disconnect( |
41 | 407 | trace, "connection_raw_execute_error", self, raw_cursor, | 407 | trace, "connection_raw_execute_error", self, raw_cursor, |
42 | 408 | statement, params or (), error) | 408 | statement, params or (), error) |
43 | @@ -423,7 +423,7 @@ | |||
44 | 423 | elif self._state == STATE_RECONNECT: | 423 | elif self._state == STATE_RECONNECT: |
45 | 424 | try: | 424 | try: |
46 | 425 | self._raw_connection = self._database.raw_connect() | 425 | self._raw_connection = self._database.raw_connect() |
48 | 426 | except DatabaseError, exc: | 426 | except DatabaseError as exc: |
49 | 427 | self._state = STATE_DISCONNECTED | 427 | self._state = STATE_DISCONNECTED |
50 | 428 | self._raw_connection = None | 428 | self._raw_connection = None |
51 | 429 | raise DisconnectionError(str(exc)) | 429 | raise DisconnectionError(str(exc)) |
52 | @@ -452,7 +452,7 @@ | |||
53 | 452 | 'extra_disconnection_errors', ()) | 452 | 'extra_disconnection_errors', ()) |
54 | 453 | try: | 453 | try: |
55 | 454 | return function(*args, **kwargs) | 454 | return function(*args, **kwargs) |
57 | 455 | except Exception, exc: | 455 | except Exception as exc: |
58 | 456 | if self.is_disconnection_error(exc, extra_disconnection_errors): | 456 | if self.is_disconnection_error(exc, extra_disconnection_errors): |
59 | 457 | self._state = STATE_DISCONNECTED | 457 | self._state = STATE_DISCONNECTED |
60 | 458 | self._raw_connection = None | 458 | self._raw_connection = None |
61 | 459 | 459 | ||
62 | === modified file 'storm/databases/sqlite.py' | |||
63 | --- storm/databases/sqlite.py 2015-06-15 12:02:12 +0000 | |||
64 | +++ storm/databases/sqlite.py 2019-05-30 13:43:46 +0000 | |||
65 | @@ -157,7 +157,7 @@ | |||
66 | 157 | while True: | 157 | while True: |
67 | 158 | try: | 158 | try: |
68 | 159 | return Connection.raw_execute(self, statement, params) | 159 | return Connection.raw_execute(self, statement, params) |
70 | 160 | except sqlite.OperationalError, e: | 160 | except sqlite.OperationalError as e: |
71 | 161 | if str(e) != "database is locked": | 161 | if str(e) != "database is locked": |
72 | 162 | raise | 162 | raise |
73 | 163 | elif now() - started < self._database._timeout: | 163 | elif now() - started < self._database._timeout: |
74 | 164 | 164 | ||
75 | === modified file 'storm/schema/schema.py' | |||
76 | --- storm/schema/schema.py 2015-01-26 09:57:25 +0000 | |||
77 | +++ storm/schema/schema.py 2019-05-30 13:43:46 +0000 | |||
78 | @@ -172,7 +172,7 @@ | |||
79 | 172 | except SchemaMissingError: | 172 | except SchemaMissingError: |
80 | 173 | # No schema at all. Create it from the ground. | 173 | # No schema at all. Create it from the ground. |
81 | 174 | self.create(store) | 174 | self.create(store) |
83 | 175 | except UnappliedPatchesError, error: | 175 | except UnappliedPatchesError as error: |
84 | 176 | patch_applier.check_unknown() | 176 | patch_applier.check_unknown() |
85 | 177 | for version in error.unapplied_versions: | 177 | for version in error.unapplied_versions: |
86 | 178 | self.advance(store, version) | 178 | self.advance(store, version) |
87 | 179 | 179 | ||
88 | === modified file 'storm/schema/sharding.py' | |||
89 | --- storm/schema/sharding.py 2014-12-28 11:51:53 +0000 | |||
90 | +++ storm/schema/sharding.py 2019-05-30 13:43:46 +0000 | |||
91 | @@ -101,7 +101,7 @@ | |||
92 | 101 | schema.check(store) | 101 | schema.check(store) |
93 | 102 | except SchemaMissingError: | 102 | except SchemaMissingError: |
94 | 103 | schema.create(store) | 103 | schema.create(store) |
96 | 104 | except UnappliedPatchesError, error: | 104 | except UnappliedPatchesError as error: |
97 | 105 | if not unapplied_versions: | 105 | if not unapplied_versions: |
98 | 106 | unapplied_versions = error.unapplied_versions | 106 | unapplied_versions = error.unapplied_versions |
99 | 107 | elif unapplied_versions != error.unapplied_versions: | 107 | elif unapplied_versions != error.unapplied_versions: |
100 | 108 | 108 | ||
101 | === modified file 'storm/twisted/transact.py' | |||
102 | --- storm/twisted/transact.py 2011-12-07 10:39:57 +0000 | |||
103 | +++ storm/twisted/transact.py 2019-05-30 13:43:46 +0000 | |||
104 | @@ -75,7 +75,7 @@ | |||
105 | 75 | try: | 75 | try: |
106 | 76 | result = function(*args, **kwargs) | 76 | result = function(*args, **kwargs) |
107 | 77 | self._transaction.commit() | 77 | self._transaction.commit() |
109 | 78 | except RETRIABLE_ERRORS, error: | 78 | except RETRIABLE_ERRORS as error: |
110 | 79 | if isinstance(error, DisconnectionError): | 79 | if isinstance(error, DisconnectionError): |
111 | 80 | # If we got a disconnection, calling rollback may not be | 80 | # If we got a disconnection, calling rollback may not be |
112 | 81 | # enough because psycopg2 doesn't necessarily use the | 81 | # enough because psycopg2 doesn't necessarily use the |
113 | 82 | 82 | ||
114 | === modified file 'tests/databases/base.py' | |||
115 | --- tests/databases/base.py 2016-03-10 12:04:01 +0000 | |||
116 | +++ tests/databases/base.py 2019-05-30 13:43:46 +0000 | |||
117 | @@ -344,7 +344,7 @@ | |||
118 | 344 | connection2.execute("UPDATE test SET title='Title 100' " | 344 | connection2.execute("UPDATE test SET title='Title 100' " |
119 | 345 | "WHERE id=10") | 345 | "WHERE id=10") |
120 | 346 | connection2.commit() | 346 | connection2.commit() |
122 | 347 | except OperationalError, e: | 347 | except OperationalError as e: |
123 | 348 | self.assertEquals(str(e), "database is locked") # SQLite blocks | 348 | self.assertEquals(str(e), "database is locked") # SQLite blocks |
124 | 349 | result = connection1.execute("SELECT title FROM test WHERE id=10") | 349 | result = connection1.execute("SELECT title FROM test WHERE id=10") |
125 | 350 | self.assertEquals(result.get_one(), ("Title 10",)) | 350 | self.assertEquals(result.get_one(), ("Title 10",)) |
126 | @@ -770,7 +770,7 @@ | |||
127 | 770 | cursor = self.connection._raw_connection.cursor() | 770 | cursor = self.connection._raw_connection.cursor() |
128 | 771 | cursor.execute("SELECT 1") | 771 | cursor.execute("SELECT 1") |
129 | 772 | cursor.fetchone() | 772 | cursor.fetchone() |
131 | 773 | except Error, exc: | 773 | except Error as exc: |
132 | 774 | self.assertTrue(self.connection.is_disconnection_error(exc)) | 774 | self.assertTrue(self.connection.is_disconnection_error(exc)) |
133 | 775 | else: | 775 | else: |
134 | 776 | self.fail("Disconnection was not caught.") | 776 | self.fail("Disconnection was not caught.") |
135 | @@ -779,7 +779,7 @@ | |||
136 | 779 | # error when called. | 779 | # error when called. |
137 | 780 | try: | 780 | try: |
138 | 781 | self.connection._raw_connection.rollback() | 781 | self.connection._raw_connection.rollback() |
140 | 782 | except Error, exc: | 782 | except Error as exc: |
141 | 783 | self.assertTrue(self.connection.is_disconnection_error(exc)) | 783 | self.assertTrue(self.connection.is_disconnection_error(exc)) |
142 | 784 | else: | 784 | else: |
143 | 785 | self.fail("Disconnection was not raised.") | 785 | self.fail("Disconnection was not raised.") |
144 | @@ -803,7 +803,7 @@ | |||
145 | 803 | cursor = self.connection._raw_connection.cursor() | 803 | cursor = self.connection._raw_connection.cursor() |
146 | 804 | cursor.execute("SELECT 1") | 804 | cursor.execute("SELECT 1") |
147 | 805 | cursor.fetchone() | 805 | cursor.fetchone() |
149 | 806 | except DatabaseError, exc: | 806 | except DatabaseError as exc: |
150 | 807 | self.assertTrue(self.connection.is_disconnection_error(exc)) | 807 | self.assertTrue(self.connection.is_disconnection_error(exc)) |
151 | 808 | else: | 808 | else: |
152 | 809 | self.fail("Disconnection was not caught.") | 809 | self.fail("Disconnection was not caught.") |
153 | 810 | 810 | ||
154 | === modified file 'tests/databases/postgres.py' | |||
155 | --- tests/databases/postgres.py 2016-04-29 08:38:51 +0000 | |||
156 | +++ tests/databases/postgres.py 2019-05-30 13:43:46 +0000 | |||
157 | @@ -741,7 +741,7 @@ | |||
158 | 741 | self.connection._raw_connection = FakeConnection() | 741 | self.connection._raw_connection = FakeConnection() |
159 | 742 | try: | 742 | try: |
160 | 743 | self.connection.rollback() | 743 | self.connection.rollback() |
162 | 744 | except Exception, exc: | 744 | except Exception as exc: |
163 | 745 | self.fail('Exception should have been swallowed: %s' % repr(exc)) | 745 | self.fail('Exception should have been swallowed: %s' % repr(exc)) |
164 | 746 | 746 | ||
165 | 747 | 747 | ||
166 | @@ -875,7 +875,7 @@ | |||
167 | 875 | self.remaining_time = 0.001 | 875 | self.remaining_time = 0.001 |
168 | 876 | try: | 876 | try: |
169 | 877 | self.connection.execute(statement) | 877 | self.connection.execute(statement) |
171 | 878 | except TimeoutError, e: | 878 | except TimeoutError as e: |
172 | 879 | self.assertEqual("SQL server cancelled statement", e.message) | 879 | self.assertEqual("SQL server cancelled statement", e.message) |
173 | 880 | self.assertEqual(statement, e.statement) | 880 | self.assertEqual(statement, e.statement) |
174 | 881 | self.assertEqual((), e.params) | 881 | self.assertEqual((), e.params) |
175 | 882 | 882 | ||
176 | === modified file 'tests/databases/sqlite.py' | |||
177 | --- tests/databases/sqlite.py 2013-05-05 10:36:13 +0000 | |||
178 | +++ tests/databases/sqlite.py 2019-05-30 13:43:46 +0000 | |||
179 | @@ -114,7 +114,7 @@ | |||
180 | 114 | started = time.time() | 114 | started = time.time() |
181 | 115 | try: | 115 | try: |
182 | 116 | connection2.execute("INSERT INTO test VALUES (2)") | 116 | connection2.execute("INSERT INTO test VALUES (2)") |
184 | 117 | except OperationalError, exception: | 117 | except OperationalError as exception: |
185 | 118 | self.assertEquals(str(exception), "database is locked") | 118 | self.assertEquals(str(exception), "database is locked") |
186 | 119 | self.assertTrue(time.time()-started >= 0.3) | 119 | self.assertTrue(time.time()-started >= 0.3) |
187 | 120 | else: | 120 | else: |
188 | @@ -141,7 +141,7 @@ | |||
189 | 141 | started = time.time() | 141 | started = time.time() |
190 | 142 | try: | 142 | try: |
191 | 143 | connection1.commit() | 143 | connection1.commit() |
193 | 144 | except OperationalError, exception: | 144 | except OperationalError as exception: |
194 | 145 | self.assertEquals(str(exception), "database is locked") | 145 | self.assertEquals(str(exception), "database is locked") |
195 | 146 | # In 0.10, the next assertion failed because the timeout wasn't | 146 | # In 0.10, the next assertion failed because the timeout wasn't |
196 | 147 | # enforced for the "COMMIT" statement. | 147 | # enforced for the "COMMIT" statement. |
197 | 148 | 148 | ||
198 | === modified file 'tests/mocker.py' | |||
199 | --- tests/mocker.py 2008-05-18 10:22:29 +0000 | |||
200 | +++ tests/mocker.py 2019-05-30 13:43:46 +0000 | |||
201 | @@ -487,7 +487,7 @@ | |||
202 | 487 | for event in self._events: | 487 | for event in self._events: |
203 | 488 | try: | 488 | try: |
204 | 489 | event.verify() | 489 | event.verify() |
206 | 490 | except AssertionError, e: | 490 | except AssertionError as e: |
207 | 491 | error = str(e) | 491 | error = str(e) |
208 | 492 | if not error: | 492 | if not error: |
209 | 493 | raise RuntimeError("Empty error message from %r" | 493 | raise RuntimeError("Empty error message from %r" |
210 | @@ -1029,7 +1029,7 @@ | |||
211 | 1029 | path.root_object = object | 1029 | path.root_object = object |
212 | 1030 | try: | 1030 | try: |
213 | 1031 | return self.__mocker__.act(path) | 1031 | return self.__mocker__.act(path) |
215 | 1032 | except MatchError, exception: | 1032 | except MatchError as exception: |
216 | 1033 | root_mock = path.root_mock | 1033 | root_mock = path.root_mock |
217 | 1034 | if (path.root_object is not None and | 1034 | if (path.root_object is not None and |
218 | 1035 | root_mock.__mocker_passthrough__): | 1035 | root_mock.__mocker_passthrough__): |
219 | @@ -1037,7 +1037,7 @@ | |||
220 | 1037 | # Reinstantiate to show raise statement on traceback, and | 1037 | # Reinstantiate to show raise statement on traceback, and |
221 | 1038 | # also to make the traceback shown shorter. | 1038 | # also to make the traceback shown shorter. |
222 | 1039 | raise MatchError(str(exception)) | 1039 | raise MatchError(str(exception)) |
224 | 1040 | except AssertionError, e: | 1040 | except AssertionError as e: |
225 | 1041 | lines = str(e).splitlines() | 1041 | lines = str(e).splitlines() |
226 | 1042 | message = [ERROR_PREFIX + "Unmet expectation:", ""] | 1042 | message = [ERROR_PREFIX + "Unmet expectation:", ""] |
227 | 1043 | message.append("=> " + lines.pop(0)) | 1043 | message.append("=> " + lines.pop(0)) |
228 | @@ -1083,7 +1083,7 @@ | |||
229 | 1083 | # something that doesn't offer them. | 1083 | # something that doesn't offer them. |
230 | 1084 | try: | 1084 | try: |
231 | 1085 | result = self.__mocker_act__("len") | 1085 | result = self.__mocker_act__("len") |
233 | 1086 | except MatchError, e: | 1086 | except MatchError as e: |
234 | 1087 | raise AttributeError(str(e)) | 1087 | raise AttributeError(str(e)) |
235 | 1088 | if type(result) is Mock: | 1088 | if type(result) is Mock: |
236 | 1089 | return 0 | 1089 | return 0 |
237 | @@ -1092,7 +1092,7 @@ | |||
238 | 1092 | def __nonzero__(self): | 1092 | def __nonzero__(self): |
239 | 1093 | try: | 1093 | try: |
240 | 1094 | return self.__mocker_act__("nonzero") | 1094 | return self.__mocker_act__("nonzero") |
242 | 1095 | except MatchError, e: | 1095 | except MatchError as e: |
243 | 1096 | return True | 1096 | return True |
244 | 1097 | 1097 | ||
245 | 1098 | def __iter__(self): | 1098 | def __iter__(self): |
246 | @@ -1519,7 +1519,7 @@ | |||
247 | 1519 | for task in self._tasks: | 1519 | for task in self._tasks: |
248 | 1520 | try: | 1520 | try: |
249 | 1521 | task_result = task.run(path) | 1521 | task_result = task.run(path) |
251 | 1522 | except AssertionError, e: | 1522 | except AssertionError as e: |
252 | 1523 | error = str(e) | 1523 | error = str(e) |
253 | 1524 | if not error: | 1524 | if not error: |
254 | 1525 | raise RuntimeError("Empty error message from %r" % task) | 1525 | raise RuntimeError("Empty error message from %r" % task) |
255 | @@ -1562,7 +1562,7 @@ | |||
256 | 1562 | for task in self._tasks: | 1562 | for task in self._tasks: |
257 | 1563 | try: | 1563 | try: |
258 | 1564 | task.verify() | 1564 | task.verify() |
260 | 1565 | except AssertionError, e: | 1565 | except AssertionError as e: |
261 | 1566 | error = str(e) | 1566 | error = str(e) |
262 | 1567 | if not error: | 1567 | if not error: |
263 | 1568 | raise RuntimeError("Empty error message from %r" % task) | 1568 | raise RuntimeError("Empty error message from %r" % task) |
264 | 1569 | 1569 | ||
265 | === modified file 'tests/schema/patch.py' | |||
266 | --- tests/schema/patch.py 2014-12-18 10:57:52 +0000 | |||
267 | +++ tests/schema/patch.py 2019-05-30 13:43:46 +0000 | |||
268 | @@ -345,7 +345,7 @@ | |||
269 | 345 | self.add_module("patch_999.py", patch_no_args_apply) | 345 | self.add_module("patch_999.py", patch_no_args_apply) |
270 | 346 | try: | 346 | try: |
271 | 347 | self.patch_applier.apply_all() | 347 | self.patch_applier.apply_all() |
273 | 348 | except BadPatchError, e: | 348 | except BadPatchError as e: |
274 | 349 | self.assertTrue("mypackage/patch_999.py" in str(e)) | 349 | self.assertTrue("mypackage/patch_999.py" in str(e)) |
275 | 350 | self.assertTrue("takes no arguments" in str(e)) | 350 | self.assertTrue("takes no arguments" in str(e)) |
276 | 351 | self.assertTrue("TypeError" in str(e)) | 351 | self.assertTrue("TypeError" in str(e)) |
277 | @@ -360,7 +360,7 @@ | |||
278 | 360 | self.add_module("patch_999.py", patch_missing_apply) | 360 | self.add_module("patch_999.py", patch_missing_apply) |
279 | 361 | try: | 361 | try: |
280 | 362 | self.patch_applier.apply_all() | 362 | self.patch_applier.apply_all() |
282 | 363 | except BadPatchError, e: | 363 | except BadPatchError as e: |
283 | 364 | self.assertTrue("mypackage/patch_999.py" in str(e)) | 364 | self.assertTrue("mypackage/patch_999.py" in str(e)) |
284 | 365 | self.assertTrue("no attribute" in str(e)) | 365 | self.assertTrue("no attribute" in str(e)) |
285 | 366 | self.assertTrue("AttributeError" in str(e)) | 366 | self.assertTrue("AttributeError" in str(e)) |
286 | @@ -375,7 +375,7 @@ | |||
287 | 375 | self.add_module("patch_999.py", "that's not python") | 375 | self.add_module("patch_999.py", "that's not python") |
288 | 376 | try: | 376 | try: |
289 | 377 | self.patch_applier.apply_all() | 377 | self.patch_applier.apply_all() |
291 | 378 | except BadPatchError, e: | 378 | except BadPatchError as e: |
292 | 379 | self.assertTrue(" 999 " in str(e)) | 379 | self.assertTrue(" 999 " in str(e)) |
293 | 380 | self.assertTrue("SyntaxError" in str(e)) | 380 | self.assertTrue("SyntaxError" in str(e)) |
294 | 381 | else: | 381 | else: |
295 | @@ -389,7 +389,7 @@ | |||
296 | 389 | self.add_module("patch_999.py", patch_name_error) | 389 | self.add_module("patch_999.py", patch_name_error) |
297 | 390 | try: | 390 | try: |
298 | 391 | self.patch_applier.apply_all() | 391 | self.patch_applier.apply_all() |
300 | 392 | except BadPatchError, e: | 392 | except BadPatchError as e: |
301 | 393 | self.assertTrue("mypackage/patch_999.py" in str(e)) | 393 | self.assertTrue("mypackage/patch_999.py" in str(e)) |
302 | 394 | self.assertTrue("NameError" in str(e)) | 394 | self.assertTrue("NameError" in str(e)) |
303 | 395 | self.assertTrue("blah" in str(e)) | 395 | self.assertTrue("blah" in str(e)) |
304 | 396 | 396 | ||
305 | === modified file 'tests/store/base.py' | |||
306 | --- tests/store/base.py 2019-05-29 15:35:00 +0000 | |||
307 | +++ tests/store/base.py 2019-05-30 13:43:46 +0000 | |||
308 | @@ -5929,7 +5929,7 @@ | |||
309 | 5929 | self.store.commit() | 5929 | self.store.commit() |
310 | 5930 | try: | 5930 | try: |
311 | 5931 | self.assertEquals(myfoo.title, title) | 5931 | self.assertEquals(myfoo.title, title) |
313 | 5932 | except AssertionError, e: | 5932 | except AssertionError as e: |
314 | 5933 | raise AssertionError(unicode(e, 'replace') + | 5933 | raise AssertionError(unicode(e, 'replace') + |
315 | 5934 | " (ensure your database was created with CREATE DATABASE" | 5934 | " (ensure your database was created with CREATE DATABASE" |
316 | 5935 | " ... CHARACTER SET utf8)") | 5935 | " ... CHARACTER SET utf8)") |
317 | 5936 | 5936 | ||
318 | === modified file 'tests/tracer.py' | |||
319 | --- tests/tracer.py 2012-06-28 14:21:49 +0000 | |||
320 | +++ tests/tracer.py 2019-05-30 13:43:46 +0000 | |||
321 | @@ -290,7 +290,7 @@ | |||
322 | 290 | 290 | ||
323 | 291 | try: | 291 | try: |
324 | 292 | self.execute() | 292 | self.execute() |
326 | 293 | except TimeoutError, e: | 293 | except TimeoutError as e: |
327 | 294 | self.assertEqual("0 seconds remaining in time budget", e.message) | 294 | self.assertEqual("0 seconds remaining in time budget", e.message) |
328 | 295 | self.assertEqual(self.statement, e.statement) | 295 | self.assertEqual(self.statement, e.statement) |
329 | 296 | self.assertEqual(self.params, e.params) | 296 | self.assertEqual(self.params, e.params) |
330 | @@ -662,7 +662,7 @@ | |||
331 | 662 | try: | 662 | try: |
332 | 663 | with CaptureTracer(): | 663 | with CaptureTracer(): |
333 | 664 | raise RuntimeError("boom") | 664 | raise RuntimeError("boom") |
335 | 665 | except RuntimeError, error: | 665 | except RuntimeError as error: |
336 | 666 | errors.append(error) | 666 | errors.append(error) |
337 | 667 | [error] = errors | 667 | [error] = errors |
338 | 668 | self.assertEqual("boom", str(error)) | 668 | self.assertEqual("boom", str(error)) |
339 | 669 | 669 | ||
340 | === modified file 'tests/variables.py' | |||
341 | --- tests/variables.py 2019-04-07 16:20:40 +0000 | |||
342 | +++ tests/variables.py 2019-05-30 13:43:46 +0000 | |||
343 | @@ -143,7 +143,7 @@ | |||
344 | 143 | variable = CustomVariable(allow_none=False, column=column) | 143 | variable = CustomVariable(allow_none=False, column=column) |
345 | 144 | try: | 144 | try: |
346 | 145 | variable.set(None) | 145 | variable.set(None) |
348 | 146 | except NoneError, e: | 146 | except NoneError as e: |
349 | 147 | pass | 147 | pass |
350 | 148 | self.assertTrue("column_name" in str(e)) | 148 | self.assertTrue("column_name" in str(e)) |
351 | 149 | 149 | ||
352 | @@ -152,7 +152,7 @@ | |||
353 | 152 | variable = CustomVariable(allow_none=False, column=column) | 152 | variable = CustomVariable(allow_none=False, column=column) |
354 | 153 | try: | 153 | try: |
355 | 154 | variable.set(None) | 154 | variable.set(None) |
357 | 155 | except NoneError, e: | 155 | except NoneError as e: |
358 | 156 | pass | 156 | pass |
359 | 157 | self.assertTrue("table_name.column_name" in str(e)) | 157 | self.assertTrue("table_name.column_name" in str(e)) |
360 | 158 | 158 | ||
361 | @@ -769,7 +769,7 @@ | |||
362 | 769 | def test_unsupported_unit(self): | 769 | def test_unsupported_unit(self): |
363 | 770 | try: | 770 | try: |
364 | 771 | self.check("1 month", None) | 771 | self.check("1 month", None) |
366 | 772 | except ValueError, e: | 772 | except ValueError as e: |
367 | 773 | self.assertEquals(str(e), "Unsupported interval unit 'month' " | 773 | self.assertEquals(str(e), "Unsupported interval unit 'month' " |
368 | 774 | "in interval '1 month'") | 774 | "in interval '1 month'") |
369 | 775 | else: | 775 | else: |
370 | @@ -778,7 +778,7 @@ | |||
371 | 778 | def test_missing_value(self): | 778 | def test_missing_value(self): |
372 | 779 | try: | 779 | try: |
373 | 780 | self.check("day", None) | 780 | self.check("day", None) |
375 | 781 | except ValueError, e: | 781 | except ValueError as e: |
376 | 782 | self.assertEquals(str(e), "Expected an interval value rather than " | 782 | self.assertEquals(str(e), "Expected an interval value rather than " |
377 | 783 | "'day' in interval 'day'") | 783 | "'day' in interval 'day'") |
378 | 784 | else: | 784 | else: |
379 | 785 | 785 | ||
380 | === modified file 'tests/zope/zstorm.py' | |||
381 | --- tests/zope/zstorm.py 2012-03-06 10:28:06 +0000 | |||
382 | +++ tests/zope/zstorm.py 2019-05-30 13:43:46 +0000 | |||
383 | @@ -355,7 +355,7 @@ | |||
384 | 355 | store.execute("SELECT 1") | 355 | store.execute("SELECT 1") |
385 | 356 | except ZStormError: | 356 | except ZStormError: |
386 | 357 | failures.append("ZStormError raised") | 357 | failures.append("ZStormError raised") |
388 | 358 | except Exception, exc: | 358 | except Exception as exc: |
389 | 359 | failures.append("Expected ZStormError, got %r" % exc) | 359 | failures.append("Expected ZStormError, got %r" % exc) |
390 | 360 | else: | 360 | else: |
391 | 361 | failures.append("Expected ZStormError, nothing raised") | 361 | failures.append("Expected ZStormError, nothing raised") |
+1 LGTM
<3 short mechanical reviews