Skip to content

Commit

Permalink
Add test for osi3trace offset reading robustness
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre R. Mai <[email protected]>
  • Loading branch information
pmai committed Apr 5, 2024
1 parent c6735c6 commit 98793fb
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_osi_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@ def test_osi_trace(self):

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

def test_osi_trace_offsets_robustness(self):
with tempfile.TemporaryDirectory() as tmpdirname:
path_input = os.path.join(tmpdirname, "input.osi")
create_sample(path_input)

trace = OSITrace(path_input)
# Test whether the function can handle be run multiple times safely
offsets = trace.retrieve_offsets(None)
offsets2 = trace.retrieve_offsets(None)
trace.close()

self.assertEqual(len(offsets), 10)
self.assertEqual(offsets, offsets2)


def create_sample(path):
f = open(path, "ab")
Expand Down

0 comments on commit 98793fb

Please sign in to comment.