Skip to content
Snippets Groups Projects
Commit 707a44cf authored by Jan David Mol's avatar Jan David Mol
Browse files

L2SS-674: Explicitly test writing multiple subbands with the XST statistics_writer

parent 11755b4e
No related branches found
No related tags found
1 merge request!267L2SS-674: Explicitly test writing multiple subbands with the XST statistics_writer
File suppressed by a .gitattributes entry, the file's encoding is unsupported, or the file size exceeds the limit.
......@@ -10,7 +10,7 @@
from tangostationcontrol.test import base
from tangostationcontrol.statistics_writer import statistics_writer
import sys
from os.path import dirname
from os.path import dirname, isfile
from tempfile import TemporaryDirectory
from unittest import mock
......@@ -22,9 +22,27 @@ class TestStatisticsWriter(base.TestCase):
with self.assertRaises(SystemExit):
statistics_writer.main()
# check if file was written
self.assertTrue(isfile(f"{tmpdir}/SST_2021-09-20-12-17-40.h5"))
def test_xst(self):
with TemporaryDirectory() as tmpdir:
new_sys_argv = [sys.argv[0], "--mode", "XST", "--file", dirname(__file__) + "/SDP_XST_statistics_packets.bin", "--output_dir", tmpdir]
with mock.patch.object(statistics_writer.sys, 'argv', new_sys_argv):
with self.assertRaises(SystemExit):
statistics_writer.main()
# check if file was written
self.assertTrue(isfile(f"{tmpdir}/XST_SB102_2021-09-13-13-21-32.h5"))
def test_xst_multiple_subbands(self):
with TemporaryDirectory() as tmpdir:
new_sys_argv = [sys.argv[0], "--mode", "XST", "--file", dirname(__file__) + "/SDP_XST_statistics_packets_multiple_subbands.bin", "--output_dir", tmpdir]
with mock.patch.object(statistics_writer.sys, 'argv', new_sys_argv):
with self.assertRaises(SystemExit):
statistics_writer.main()
# check if files were written
self.assertTrue(isfile(f"{tmpdir}/XST_SB102_2021-09-13-13-21-32.h5"))
self.assertTrue(isfile(f"{tmpdir}/XST_SB103_2021-09-13-13-21-32.h5"))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment