From 9f96d35f2bfe0421902e1deb5d4becacf0c5b261 Mon Sep 17 00:00:00 2001 From: Ross Allen Date: Wed, 13 Dec 2023 09:59:39 -0800 Subject: [PATCH] renaming and expanding tests --- CHANGELOG.md | 1 + src/kspdg/lbg1/README.md | 1 - .../{test_lbg1_lg0_i2.py => test_lbg1_i2.py} | 32 ++++++++++++-- .../{test_pe1_e1_i3.py => test_pe1_i3.py} | 43 +++++++++++++++++++ .../{test_sb1_e1_i5.py => test_sb1_i5.py} | 0 5 files changed, 73 insertions(+), 4 deletions(-) rename tests/ksp_ingame_tests/{test_lbg1_lg0_i2.py => test_lbg1_i2.py} (92%) rename tests/ksp_ingame_tests/{test_pe1_e1_i3.py => test_pe1_i3.py} (92%) rename tests/ksp_ingame_tests/{test_sb1_e1_i5.py => test_sb1_i5.py} (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88bd5cb..bcdc3f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- updating test file names and adding additional scenarios to the test files (e.g. `test_lbg1_lg0_i2.py` -> `test_lbg1_i2.py` so we can test lg1_i2 and lg2_i2 in the same file) - Updating print statements to logger statements in pe1 e3_envs ### Removed diff --git a/src/kspdg/lbg1/README.md b/src/kspdg/lbg1/README.md index b15f16c..3deb437 100644 --- a/src/kspdg/lbg1/README.md +++ b/src/kspdg/lbg1/README.md @@ -44,7 +44,6 @@ See `Group1BaseEnv.vessel_step()` in [`base_envs.py`](https://github.com/mit-ll/ + ID `lg0`: Lady and Guard are passive, no maneuvering + ID `lg1`: Lady is passive, Guard applies heuristic pursuit of Bandit using target-zero_vel-target relative maneuver sequence + ID `lg2`: Lady applies hueristic evasive maneuvers of Bandit using out-of-plane burns in order to maintian constant period of orbit, Guard applies heuristic pursuit of Bandit using target-zero_vel-target relative maneuver sequence - + _NotImplemented_ + ID `lgnash1`: Lady is passive, Nash-equliibrium/optimal pursuit maneuvers for Guard + _NotImplemented_ + ID `lgnash2`: Nash-equliibrium/optimal pursuit maneuvers for Lady and Guard diff --git a/tests/ksp_ingame_tests/test_lbg1_lg0_i2.py b/tests/ksp_ingame_tests/test_lbg1_i2.py similarity index 92% rename from tests/ksp_ingame_tests/test_lbg1_lg0_i2.py rename to tests/ksp_ingame_tests/test_lbg1_i2.py index 91bbade..4d7b6c2 100644 --- a/tests/ksp_ingame_tests/test_lbg1_lg0_i2.py +++ b/tests/ksp_ingame_tests/test_lbg1_i2.py @@ -14,17 +14,43 @@ import kspdg.utils.constants as C from kspdg.lbg1.lg0_envs import LBG1_LG0_I2_Env +from kspdg.lbg1.lg1_envs import LBG1_LG1_I2_Env +from kspdg.lbg1.lg2_envs import LBG1_LG2_I2_Env @pytest.fixture def lbg1_lg0_i2_env(): - """setup and teardown of the PursuitEnvV20220516 object connected to kRPC server""" + """setup and teardown of the LBG1_LG0_I2_Env object connected to kRPC server""" env = LBG1_LG0_I2_Env() env.reset() yield env env.close() -def test_smoketest_0(lbg1_lg0_i2_env): - """Simply ensure no errors are thrown from starting environment""" +@pytest.fixture +def lbg1_lg1_i2_env(): + """setup and teardown of the LBG1_LG1_I2_Env object connected to kRPC server""" + env = LBG1_LG1_I2_Env() + env.reset() + yield env + env.close() + +@pytest.fixture +def lbg1_lg2_i2_env(): + """setup and teardown of the LBG1_LG2_I2_Env object connected to kRPC server""" + env = LBG1_LG2_I2_Env() + env.reset() + yield env + env.close() + +def test_smoketest_lg0(lbg1_lg0_i2_env): + """Ensure no errors are thrown from starting LG0 environment""" + pass + +def test_smoketest_lg0(lbg1_lg1_i2_env): + """Ensure no errors are thrown from starting LG1 environment""" + pass + +def test_smoketest_lg0(lbg1_lg1_i2_env): + """Ensure no errors are thrown from starting LG2 environment""" pass def test_observation_0(lbg1_lg0_i2_env): diff --git a/tests/ksp_ingame_tests/test_pe1_e1_i3.py b/tests/ksp_ingame_tests/test_pe1_i3.py similarity index 92% rename from tests/ksp_ingame_tests/test_pe1_e1_i3.py rename to tests/ksp_ingame_tests/test_pe1_i3.py index 6ccc810..f25afcd 100644 --- a/tests/ksp_ingame_tests/test_pe1_e1_i3.py +++ b/tests/ksp_ingame_tests/test_pe1_i3.py @@ -14,6 +14,9 @@ import kspdg.utils.constants as C from kspdg.pe1.e1_envs import PE1_E1_I3_Env +from kspdg.pe1.e2_envs import PE1_E2_I3_Env +from kspdg.pe1.e3_envs import PE1_E3_I3_Env +from kspdg.pe1.e4_envs import PE1_E4_I3_Env @pytest.fixture def pe1_e1_i3_env(): @@ -23,6 +26,46 @@ def pe1_e1_i3_env(): yield env env.close() +@pytest.fixture +def pe1_e2_i3_env(): + '''setup and teardown of the pursuit-evade env object connected to kRPC server''' + env = PE1_E2_I3_Env() + env.reset() + yield env + env.close() + +@pytest.fixture +def pe1_e3_i3_env(): + '''setup and teardown of the pursuit-evade env object connected to kRPC server''' + env = PE1_E3_I3_Env() + env.reset() + yield env + env.close() + +@pytest.fixture +def pe1_e4_i3_env(): + '''setup and teardown of the pursuit-evade env object connected to kRPC server''' + env = PE1_E4_I3_Env() + env.reset() + yield env + env.close() + +def test_smoketest_e1(pe1_e1_i3_env): + """Ensure no errors are thrown from starting E1 environment""" + pass + +def test_smoketest_e2(pe1_e2_i3_env): + """Ensure no errors are thrown from starting E2 environment""" + pass + +def test_smoketest_e3(pe1_e3_i3_env): + """Ensure no errors are thrown from starting E3 environment""" + pass + +def test_smoketest_e4(pe1_e4_i3_env): + """Ensure no errors are thrown from starting E4 environment""" + pass + def test_observation_dict_list_convert_0(pe1_e1_i3_env): '''check that converting between lists and dict to not alter observation''' # ~~ ARRANGE ~~ diff --git a/tests/ksp_ingame_tests/test_sb1_e1_i5.py b/tests/ksp_ingame_tests/test_sb1_i5.py similarity index 100% rename from tests/ksp_ingame_tests/test_sb1_e1_i5.py rename to tests/ksp_ingame_tests/test_sb1_i5.py