Skip to content

Commit de54ef7

Browse files
committed
Add test for osi3trace offset reading robustness
Signed-off-by: Pierre R. Mai <[email protected]>
1 parent 70f79a7 commit de54ef7

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/test_osi_trace.py

+14
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@ def test_osi_trace(self):
2222

2323
self.assertTrue(os.path.exists(path_output))
2424

25+
def test_osi_trace_offsets_robustness(self):
26+
with tempfile.TemporaryDirectory() as tmpdirname:
27+
path_input = os.path.join(tmpdirname, "input.osi")
28+
create_sample(path_input)
29+
30+
trace = OSITrace(path_input)
31+
# Test whether the function can handle be run multiple times safely
32+
offsets = trace.retrieve_offsets(None)
33+
offsets2 = trace.retrieve_offsets(None)
34+
trace.close()
35+
36+
self.assertEqual(len(offsets), 10)
37+
self.assertEqual(offsets, offsets2)
38+
2539

2640
def create_sample(path):
2741
f = open(path, "ab")

0 commit comments

Comments
 (0)