Skip to content

Commit

Permalink
Merge pull request #85 from us-irs/minor-test-update
Browse files Browse the repository at this point in the history
minor test update: Use new name for CCSDS file seq counter
  • Loading branch information
robamu authored Oct 15, 2024
2 parents c5e075c + 5f4d654 commit c5e0017
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/test_seq_cnt_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import platform
from unittest import TestCase

from spacepackets.seqcount import PusFileSeqCountProvider
from spacepackets.seqcount import CcsdsFileSeqCountProvider
from tempfile import NamedTemporaryFile


Expand All @@ -16,7 +16,7 @@ def test_basic(self):
with NamedTemporaryFile("w+t") as file:
file.write("0\n")
file.seek(0)
seq_cnt_provider = PusFileSeqCountProvider(Path(file.name))
seq_cnt_provider = CcsdsFileSeqCountProvider(Path(file.name))
seq_cnt = seq_cnt_provider.current()
self.assertEqual(seq_cnt, 0)
# The first call will start at 0
Expand All @@ -30,14 +30,14 @@ def test_basic(self):
self.assertEqual(next(seq_cnt_provider), 0)

def test_with_real_file(self):
seq_cnt_provider = PusFileSeqCountProvider(self.file_name)
seq_cnt_provider = CcsdsFileSeqCountProvider(self.file_name)
self.assertTrue(self.file_name.exists())
self.assertEqual(seq_cnt_provider.current(), 0)
self.assertEqual(next(seq_cnt_provider), 0)
pass

def test_file_deleted_runtime(self):
seq_cnt_provider = PusFileSeqCountProvider(self.file_name)
seq_cnt_provider = CcsdsFileSeqCountProvider(self.file_name)
self.assertTrue(self.file_name.exists())
os.remove(self.file_name)
with self.assertRaises(FileNotFoundError):
Expand All @@ -50,13 +50,13 @@ def test_faulty_file_entry(self):
with NamedTemporaryFile("w+t") as file:
file.write("-1\n")
file.seek(0)
seq_cnt_provider = PusFileSeqCountProvider(Path(file.name))
seq_cnt_provider = CcsdsFileSeqCountProvider(Path(file.name))
with self.assertRaises(ValueError):
next(seq_cnt_provider)
file.write(f"{pow(2, 15)}\n")
file.seek(0)
file.flush()
seq_cnt_provider = PusFileSeqCountProvider(Path(file.name))
seq_cnt_provider = CcsdsFileSeqCountProvider(Path(file.name))
with self.assertRaises(ValueError):
next(seq_cnt_provider)

Expand Down

0 comments on commit c5e0017

Please sign in to comment.