Skip to content

Commit 39c937f

Browse files
committed
fix: Refactor benchmark
1 parent 1e9e75d commit 39c937f

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

tests/benchmark.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@
1414
import os
1515
import io
1616
import json
17-
import pytest
17+
import shutil
1818
from c2pa import Reader, Builder, Signer, C2paSigningAlg, C2paSignerInfo
1919

2020
PROJECT_PATH = os.getcwd()
2121

2222
# Test paths
2323
test_path = os.path.join(PROJECT_PATH, "tests", "fixtures", "C.jpg")
24-
output_path = "target/python_out.jpg"
24+
temp_dir = os.path.join(PROJECT_PATH, "tests", "temp")
25+
output_path = os.path.join(temp_dir, "python_out.jpg")
2526

26-
# Ensure target directory exists
27-
os.makedirs(os.path.dirname(output_path), exist_ok=True)
27+
# Ensure temp directory exists
28+
os.makedirs(temp_dir, exist_ok=True)
2829

2930
manifestDefinition = {
3031
"claim_generator": "python_test",
@@ -137,3 +138,9 @@ def test_files_builder_signer_benchmark(benchmark):
137138
def test_streams_builder_benchmark(benchmark):
138139
"""Benchmark stream-based building."""
139140
benchmark(test_streams_build)
141+
142+
143+
def teardown_module(module):
144+
"""Clean up temporary files after all tests."""
145+
if os.path.exists(temp_dir):
146+
shutil.rmtree(temp_dir)

0 commit comments

Comments
 (0)