Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor test update: Use new name for CCSDS file seq counter #85

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading