generated from ut-issl/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #150 from ut-issl/feature/add-pytest
Add pytest
- Loading branch information
Showing
25 changed files
with
119 additions
and
1 deletion.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -60,4 +60,8 @@ Debug/ | |
Release/ | ||
|
||
# for c2a user sample | ||
Examples/src_aobc | ||
Examples/src_aobc | ||
|
||
# pytest cache | ||
*.pyc | ||
|
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,4 @@ | ||
[pytest] | ||
markers = | ||
real | ||
sils |
Empty file.
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,30 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
import os | ||
import sys | ||
|
||
import isslwings as wings | ||
import pytest | ||
|
||
ROOT_PATH = "../../../" | ||
sys.path.append(os.path.dirname(__file__) + "/" + ROOT_PATH + "utils") | ||
import c2a_enum_utils | ||
import wings_utils | ||
|
||
c2a_enum = c2a_enum_utils.get_c2a_enum() | ||
ope = wings_utils.get_wings_operation() | ||
|
||
|
||
@pytest.mark.real | ||
@pytest.mark.sils | ||
def test_nop(): | ||
assert "SUC" == wings.util.send_rt_cmd_and_confirm( | ||
ope, | ||
c2a_enum.Cmd_CODE_NOP, | ||
(), | ||
c2a_enum.Tlm_CODE_AOBC_HK_GEN, | ||
) | ||
|
||
if __name__ == "__main__": | ||
pass |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
51 changes: 51 additions & 0 deletions
51
src/src_user/Test/test/src_user/Applications/UserDefined/AOCS/test_aocs_manager.py
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,51 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
import os | ||
import sys | ||
|
||
import isslwings as wings | ||
import pytest | ||
|
||
import time | ||
|
||
ROOT_PATH = "../../../../../" | ||
sys.path.append(os.path.dirname(__file__) + "/" + ROOT_PATH + "utils") | ||
import c2a_enum_utils | ||
import wings_utils | ||
|
||
c2a_enum = c2a_enum_utils.get_c2a_enum() | ||
ope = wings_utils.get_wings_operation() | ||
|
||
|
||
@pytest.mark.real | ||
@pytest.mark.sils | ||
def test_target_quaternion(): | ||
assert "SUC" == wings.util.send_rt_cmd_and_confirm( | ||
ope, | ||
c2a_enum.Cmd_CODE_APP_AOCS_MANAGER_SET_TARGET_QUATERNION, | ||
(0.0, 0.0, 0.0, 1.0), | ||
c2a_enum.Tlm_CODE_AOBC_HK_GEN, | ||
) | ||
time.sleep(1.0) | ||
tlm_AOBC_HK_ALGO = ope.get_latest_tlm(c2a_enum.Tlm_CODE_AOBC_HK_ALGO)[0] | ||
assert tlm_AOBC_HK_ALGO["AOBC_HK_ALGO.QUATERNION.TARGET_I2T_X"] == 0.0 | ||
assert tlm_AOBC_HK_ALGO["AOBC_HK_ALGO.QUATERNION.TARGET_I2T_Y"] == 0.0 | ||
assert tlm_AOBC_HK_ALGO["AOBC_HK_ALGO.QUATERNION.TARGET_I2T_Z"] == 0.0 | ||
assert tlm_AOBC_HK_ALGO["AOBC_HK_ALGO.QUATERNION.TARGET_I2T_W"] == 1.0 | ||
|
||
@pytest.mark.real | ||
@pytest.mark.sils | ||
def test_julian_day(): | ||
assert "SUC" == wings.util.send_rt_cmd_and_confirm( | ||
ope, | ||
c2a_enum.Cmd_CODE_APP_AOCS_MANAGER_SET_REFERENCE_TIME, | ||
(2459933.0,), | ||
c2a_enum.Tlm_CODE_AOBC_HK_GEN, | ||
) | ||
time.sleep(1.0) | ||
tlm_AOBC_HK_ALGO = ope.get_latest_tlm(c2a_enum.Tlm_CODE_AOBC_HK_ALGO)[0] | ||
assert tlm_AOBC_HK_ALGO["AOBC_HK_ALGO.TIME.REFERENCE_jday"] >= 2459933.0 | ||
|
||
if __name__ == "__main__": | ||
pass |
Empty file.
Empty file.
Empty file.
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,12 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
import json | ||
import os | ||
import c2aenum as c2a | ||
|
||
|
||
def get_c2a_enum(): | ||
c2a_src_abs_path = os.path.dirname(__file__).replace("\\", "/") + "/../../.." | ||
|
||
return c2a.load_enum(c2a_src_abs_path, "utf-8") | ||
|
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,17 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
import isslwings as wings | ||
|
||
obc_info = { | ||
"name": "AOBC", | ||
"hk_tlm_info": { | ||
"tlm_name": "AOBC_HK_GEN", | ||
"cmd_counter": "OBC.GS_CMD.COUNTER", | ||
"cmd_last_exec_id": "OBC.GS_CMD.LAST_EXEC_ID", | ||
"cmd_last_exec_sts": "OBC.GS_CMD.LAST_EXEC_STS", | ||
}, | ||
} | ||
|
||
|
||
def get_wings_operation(): | ||
return wings.Operation(obc_info=obc_info) |