Commit 42fa2b6
committed
Fix memory leaks in the test suite.
This works by avoiding storing a reference to the figure in the
"do_test" enclosure in the image_comparison decorator. nose keeps a
reference to all of its test functions, and thereby holds on to every
figure in every test that uses the image_comparison decorator (which is
most). Instead of using the figure in the outer scope, this just uses
the figure number, and then it's looked up when the test function is
actually run.
Also adds gc.collect() so we can ensure there are zero figures in memory
at the start of each test. Probably not strictly necessary, but it
makes analysing memory usage easier.1 parent 7b39e78 commit 42fa2b6
2 files changed
+35
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
68 | 80 | | |
69 | 81 | | |
70 | 82 | | |
71 | 83 | | |
72 | 84 | | |
73 | 85 | | |
74 | 86 | | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
| 87 | + | |
82 | 88 | | |
83 | 89 | | |
84 | 90 | | |
| |||
93 | 99 | | |
94 | 100 | | |
95 | 101 | | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
113 | | - | |
114 | | - | |
| 112 | + | |
115 | 113 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | 114 | | |
120 | 115 | | |
121 | 116 | | |
| |||
157 | 152 | | |
158 | 153 | | |
159 | 154 | | |
160 | | - | |
161 | | - | |
162 | 155 | | |
163 | 156 | | |
164 | 157 | | |
| |||
182 | 175 | | |
183 | 176 | | |
184 | 177 | | |
| 178 | + | |
| 179 | + | |
185 | 180 | | |
186 | 181 | | |
187 | 182 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
0 commit comments