Skip to content
Snippets Groups Projects
Commit 0e8e4ed1 authored by Taya Snijder's avatar Taya Snijder
Browse files

Merge branch 'L2SS-674-test-writing-multiple-xst-subbands' into 'master'

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

Closes L2SS-674

See merge request !267
parents 11755b4e 707a44cf
Branches
Tags
1 merge request!267L2SS-674: Explicitly test writing multiple subbands with the XST statistics_writer
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -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