Skip to content

Commit 0a39fca

Browse files
Cleanup of test_graph pdf files
1 parent 6e45c6a commit 0a39fca

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ MANIFEST
3535
.pytest_cache/
3636
.DS_Store
3737
*.log
38+
test_graph*.pdf

tests/test_examples.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,14 @@ def test_example(example_path):
1414

1515
# Call main() if it exists
1616
if hasattr(module, "main"):
17-
module.main()
17+
module.main()
18+
19+
def teardown_module(module):
20+
21+
# Look for pdf files in the current working directory.
22+
cwd = pathlib.Path.cwd()
23+
for pdf_file in cwd.glob("test_graph*.pdf"):
24+
try:
25+
pdf_file.unlink()
26+
except Exception as e:
27+
print(f"Failed to remove {pdf_file}: {e}")

0 commit comments

Comments
 (0)