Skip to content

Commit 6214016

Browse files
committed
close plots to save memory
1 parent b6997b6 commit 6214016

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/test_output_plots.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import sys
88
import numpy as np
99
import matplotlib.image as mpimg
10+
import matplotlib.pyplot as plt
1011
from ogcore import utils, output_plots, constants
1112

1213

@@ -166,6 +167,7 @@ def test_plot_aggregates(
166167
plot_title=plot_title,
167168
)
168169
assert fig
170+
plt.close()
169171

170172

171173
test_data = [
@@ -217,6 +219,7 @@ def test_plot_industry_aggregates(
217219
plot_title=plot_title,
218220
)
219221
assert fig
222+
plt.close()
220223

221224

222225
test_data = [
@@ -300,6 +303,7 @@ def test_plot_gdp_ratio(
300303
plot_title=plot_title,
301304
)
302305
assert fig
306+
plt.close()
303307

304308

305309
def test_plot_gdp_ratio_save_fig(tmpdir):
@@ -327,6 +331,7 @@ def test_ability_bar():
327331
plot_title=" Test Plot Title",
328332
)
329333
assert fig
334+
plt.close()
330335

331336

332337
def test_ability_bar_save_fig(tmpdir):
@@ -353,6 +358,7 @@ def test_ability_bar_ss():
353358
plot_title=" Test Plot Title",
354359
)
355360
assert fig
361+
plt.close()
356362

357363

358364
data_for_plot = np.ones(80) * 0.3
@@ -374,6 +380,7 @@ def test_ss_profiles(by_j, plot_data):
374380
plot_title=" Test Plot Title",
375381
)
376382
assert fig
383+
plt.close()
377384

378385

379386
def test_ss_profiles_save_fig(tmpdir):
@@ -398,6 +405,7 @@ def test_tpi_profiles(by_j):
398405
plot_title=" Test Plot Title",
399406
)
400407
assert fig
408+
plt.close()
401409

402410

403411
test_data = [
@@ -454,6 +462,7 @@ def test_ss_3Dplot(
454462
plot_title=plot_title,
455463
)
456464
assert fig
465+
plt.close()
457466

458467

459468
def test_ss_3Dplot_save_fig(tmpdir):
@@ -540,6 +549,7 @@ def test_inequality_plot(
540549
plot_type=plot_type,
541550
)
542551
assert fig
552+
plt.close()
543553

544554

545555
def test_inequality_plot_save_fig(tmpdir):

0 commit comments

Comments
 (0)