Skip to content

Commit dc30c46

Browse files
Merge pull request #339 from robbievanleeuwen/testing-updates
Exclude benchmarks from test coverage
2 parents aa1ed9b + cc41508 commit dc30c46

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ tests = ["tests", "*/tests"]
105105
[tool.coverage.run]
106106
branch = true
107107
source = ["sectionproperties", "tests"]
108+
omit = ["*/benchmarks/*"]
108109

109110
[tool.coverage.report]
110111
show_missing = true

tests/post/test_post.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def test_save_plot(example_section, tmp_path):
5858
d.mkdir()
5959

6060
sec.plot_mesh(filename=d / "fig.png")
61+
plt.close("all")
6162

6263

6364
def test_supplied_axis(example_section):
@@ -66,17 +67,22 @@ def test_supplied_axis(example_section):
6667
_, ax = plt.subplots()
6768

6869
sec.plot_mesh(ax=ax, render=False)
70+
plt.close("all")
6971
sec.plot_mesh(nrows=2, axis_index=1, render=False)
72+
plt.close("all")
7073

7174
with pytest.raises(ValueError, match="is not compatible"):
72-
sec.plot_mesh(nrows=2, ncols=2, axis_index=5)
75+
sec.plot_mesh(nrows=2, ncols=2, axis_index=5, render=False)
76+
77+
plt.close("all")
7378

7479

7580
def test_plot_centroids(example_section):
7681
"""Tests plotting centroids."""
7782
sec = example_section
7883
sec.calculate_geometric_properties()
7984
sec.plot_centroids(render=False)
85+
plt.close("all")
8086

8187

8288
def test_print_results(example_section):

0 commit comments

Comments
 (0)