Skip to content

Commit 838c97c

Browse files
committed
fix: Refactor path names usage in tests 2
1 parent a69be49 commit 838c97c

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

tests/test_unit_tests_threaded.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
from c2pa.c2pa import Stream
2626

2727
PROJECT_PATH = os.getcwd()
28+
FIXTURES_FOLDER = os.path.join(os.path.dirname(__file__), "fixtures")
29+
DEFAULT_TEST_FILE = os.path.join(FIXTURES_FOLDER, "C.jpg")
30+
INGREDIENT_TEST_FILE = os.path.join(FIXTURES_FOLDER, "A.jpg")
31+
ALTERNATIVE_INGREDIENT_TEST_FILE = os.path.join(FIXTURES_FOLDER, "cloud.jpg")
32+
OTHER_ALTERNATIVE_INGREDIENT_TEST_FILE = os.path.join(FIXTURES_FOLDER, "A_thumbnail.jpg")
2833

2934
# Note: Despite being threaded, some of the tests will take time to run,
3035
# as they may try to push for thread contention, or simply just have a lot
@@ -34,8 +39,8 @@
3439
class TestReaderWithThreads(unittest.TestCase):
3540
def setUp(self):
3641
# Use the fixtures_dir fixture to set up paths
37-
self.data_dir = os.path.join(os.path.dirname(__file__), "fixtures")
38-
self.testPath = os.path.join(self.data_dir, "C.jpg")
42+
self.data_dir = FIXTURES_FOLDER
43+
self.testPath = DEFAULT_TEST_FILE
3944

4045
def test_stream_read(self):
4146
def read_metadata():
@@ -163,7 +168,7 @@ def process_file(filename):
163168
class TestBuilderWithThreads(unittest.TestCase):
164169
def setUp(self):
165170
# Use the fixtures_dir fixture to set up paths
166-
self.data_dir = os.path.join(os.path.dirname(__file__), "fixtures")
171+
self.data_dir = FIXTURES_FOLDER
167172
with open(os.path.join(self.data_dir, "es256_certs.pem"), "rb") as cert_file:
168173
self.certs = cert_file.read()
169174
with open(os.path.join(self.data_dir, "es256_private.key"), "rb") as key_file:
@@ -178,10 +183,10 @@ def setUp(self):
178183
)
179184
self.signer = Signer.from_info(self.signer_info)
180185

181-
self.testPath = os.path.join(self.data_dir, "C.jpg")
182-
self.testPath2 = os.path.join(self.data_dir, "A.jpg")
183-
self.testPath3 = os.path.join(self.data_dir, "A_thumbnail.jpg")
184-
self.testPath4 = os.path.join(self.data_dir, "cloud.jpg")
186+
self.testPath = DEFAULT_TEST_FILE
187+
self.testPath2 = INGREDIENT_TEST_FILE
188+
self.testPath3 = OTHER_ALTERNATIVE_INGREDIENT_TEST_FILE
189+
self.testPath4 = ALTERNATIVE_INGREDIENT_TEST_FILE
185190

186191
# For that test manifest, we use a placeholder assertion with content
187192
# varying depending on thread/manifest, to check for data scrambling.

0 commit comments

Comments
 (0)