forked from IMAP-Science-Operations-Center/imap_processing
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Xtce combined (IMAP-Science-Operations-Center#654)
* MNT: Update telemetry generator to iterate over all packet definitions - Add a polynomial calibrator for analog conversions - Add logic for variable length BYTES Some instruments don't provide the apId column, so we can calculate it ourselves. We do need the integer apid for the XTCE file.
- Loading branch information
Showing
18 changed files
with
505 additions
and
1,052 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
"""Testing for xtce generator template.""" | ||
|
||
import sys | ||
from pathlib import Path | ||
from unittest import mock | ||
|
||
import pytest | ||
|
||
from imap_processing.ccsds import excel_to_xtce | ||
|
||
pytest.importorskip("openpyxl") | ||
|
||
|
||
@pytest.fixture() | ||
def filepath(tmpdir): | ||
p = Path(tmpdir / "test_file.xlsx").resolve() | ||
p.touch() | ||
return p | ||
|
||
|
||
# General test | ||
@mock.patch("imap_processing.ccsds.excel_to_xtce.XTCEGenerator") | ||
def test_main_general(mock_input, filepath): | ||
"""Testing base main function.""" | ||
test_args = [ | ||
"test_script", | ||
"--output", | ||
"swe.xml", | ||
f"{filepath}", | ||
] | ||
with mock.patch.object(sys, "argv", test_args): | ||
excel_to_xtce.main() | ||
mock_input.assert_called_once() | ||
|
||
|
||
# Testing without required arguments | ||
def test_main_inval_arg(): | ||
"""Testing with invalid instrument.""" | ||
test_args = [ | ||
"test_script", | ||
"--output", | ||
"glows.xml", | ||
] | ||
with mock.patch.object(sys, "argv", test_args): | ||
with pytest.raises(SystemExit): | ||
excel_to_xtce.main() | ||
|
||
|
||
# File does not exist | ||
def test_main_inval_file(): | ||
"""Testing with invalid file.""" | ||
test_args = [ | ||
"test_script", | ||
"--instrument", | ||
"glows", | ||
"not-a-valid-file.txt", | ||
] | ||
with mock.patch.object(sys, "argv", test_args): | ||
with pytest.raises(SystemExit): | ||
excel_to_xtce.main() |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.