Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork939
Commit98877c5
committed
Refactor "finally" cleanup in tests, fix minor bug
This refactors code in the test suite that uses try-finally, tosimplify and clarify what it is doing. An exception to this beinga refactoring is that a possible bug is fixed where a throwawayenvironment variable "FOO" was patched for a test and neverunpatched.There are two patterns refactored here:- try-(try-except)-finally to try-except-finally. When the entire suite of the try-block in try-finally is itself a try-except, that has the same effect as try-except-finally. (Python always attempts to run the finally suite in either case, and does so after any applicable except suite is run.)- Replacing try-finally with an appropriate context manager.(These changes do not fix, nor introduce, any flake8 errors, butthey were found by manual search for possible problems related torecent flake8 findings but outside of what flake8 can catch. Tolimit scope, this only refactors try-finally in the test suite.)1 parent48441a9 commit98877c5
3 files changed
+23
-35
lines changedLines changed: 15 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
94 | 94 |
| |
95 | 95 |
| |
96 | 96 |
| |
97 |
| - | |
98 |
| - | |
99 |
| - | |
100 |
| - | |
101 |
| - | |
102 |
| - | |
103 |
| - | |
104 |
| - | |
105 |
| - | |
106 |
| - | |
107 |
| - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
108 | 107 |
| |
109 | 108 |
| |
110 | 109 |
| |
| |||
147 | 146 |
| |
148 | 147 |
| |
149 | 148 |
| |
150 |
| - | |
151 |
| - | |
152 |
| - | |
153 |
| - | |
154 |
| - | |
155 |
| - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
156 | 154 |
| |
157 | 155 |
| |
158 | 156 |
| |
|
Lines changed: 6 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
195 | 195 |
| |
196 | 196 |
| |
197 | 197 |
| |
198 |
| - | |
199 |
| - | |
200 |
| - | |
201 |
| - | |
202 |
| - | |
203 |
| - | |
204 |
| - | |
205 |
| - | |
206 |
| - | |
207 |
| - | |
208 |
| - | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
209 | 204 |
| |
210 | 205 |
| |
211 | 206 |
| |
|
Lines changed: 2 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
847 | 847 |
| |
848 | 848 |
| |
849 | 849 |
| |
850 |
| - | |
851 |
| - | |
| 850 | + | |
852 | 851 |
| |
853 | 852 |
| |
854 | 853 |
| |
| 854 | + | |
855 | 855 |
| |
856 | 856 |
| |
857 |
| - | |
858 |
| - | |
859 |
| - | |
860 |
| - | |
861 |
| - | |
862 | 857 |
| |
863 | 858 |
| |
864 | 859 |
| |
|
0 commit comments
Comments
(0)