diff --git a/Gems/ROS2/Code/CMakeLists.txt b/Gems/ROS2/Code/CMakeLists.txt index 1b9525953..f7422b191 100644 --- a/Gems/ROS2/Code/CMakeLists.txt +++ b/Gems/ROS2/Code/CMakeLists.txt @@ -255,4 +255,3 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED) endif() endif() -add_subdirectory(PythonTests) diff --git a/Gems/ROS2/Code/PythonTests/CMakeLists.txt b/Gems/ROS2/Code/PythonTests/CMakeLists.txt deleted file mode 100644 index 851171d69..000000000 --- a/Gems/ROS2/Code/PythonTests/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (c) Contributors to the Open 3D Engine Project. -# For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT - -if (PAL_TRAIT_BUILD_TESTS_SUPPORTED) - if (PAL_TRAIT_TEST_PYTEST_SUPPORTED) - # PAL_TRAIT_BUILD macros are used by platform detection. - ly_add_pytest( - NAME Gem::${gem_name}.PythonTests - TEST_SUITE smoke - TEST_SERIAL - PATH ${CMAKE_CURRENT_LIST_DIR}/SmokeTests_Periodic.py - RUNTIME_DEPENDENCIES - Legacy::Editor - AZ::AssetProcessor - ${gem_name}.Editor - COMPONENT - SmokeTests - ) - endif () -endif () diff --git a/Gems/ROS2/Code/PythonTests/SmokeTests_Periodic.py b/Gems/ROS2/Code/PythonTests/SmokeTests_Periodic.py deleted file mode 100644 index e29628128..000000000 --- a/Gems/ROS2/Code/PythonTests/SmokeTests_Periodic.py +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. -# For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# - -import pytest -from ly_test_tools.o3de.editor_test import EditorTestSuite, EditorSingleTest - - -@pytest.mark.SUITE_periodic # Marks the test suite as being part of a Periodic test suite -@pytest.mark.parametrize("launcher_platform", ['linux_editor']) # This test works on Linux editor -@pytest.mark.parametrize("project", ["AutomatedTesting"]) # Use the AutomatedTesting project -class TestAutomation(EditorTestSuite): - # Declaring a class that extends from EditorSingleTest declares a single test. - class SmokeTests_EnterGameModeWorks(EditorSingleTest): - # This runs a Single Test in a single Editor. For further work check EditorSingleTest siblings - from .tests import SmokeTests_EnterGameModeWorks as test_module diff --git a/Gems/ROS2/Code/PythonTests/__init__.py b/Gems/ROS2/Code/PythonTests/__init__.py deleted file mode 100755 index f5193b300..000000000 --- a/Gems/ROS2/Code/PythonTests/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -""" -Copyright (c) Contributors to the Open 3D Engine Project. -For complete copyright and license terms please see the LICENSE at the root of this distribution. - -SPDX-License-Identifier: Apache-2.0 OR MIT -""" diff --git a/Gems/ROS2/Code/PythonTests/tests/SmokeTests_EnterGameModeWorks.py b/Gems/ROS2/Code/PythonTests/tests/SmokeTests_EnterGameModeWorks.py deleted file mode 100644 index 86ce4f4f4..000000000 --- a/Gems/ROS2/Code/PythonTests/tests/SmokeTests_EnterGameModeWorks.py +++ /dev/null @@ -1,114 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. -# For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# - -# Test Case Title : Check that entering into game mode works - -# List of results that we want to check, this is not 100% necessary but its a good -# practice to make it easier to debug tests. -# Here we define a tuple of tests - -# Paths to ROS rclpy are added directly as pytest is not accessing PYTHONPATH environment variable -import sys - -sys.path.append('/opt/ros/humble/lib/python3.10/site-packages') -sys.path.append('/opt/ros/humble/local/lib/python3.10/dist-packages') - - -class Tests: - enter_game_mode = ("Entered game mode", "Failed to enter game mode") - topics_published = ("Topics were published during game mode", "Failed to publish topics during game mode") - topics_not_published_outside_of_game_mode = ( - "All simulation topics closed", "Failed to close publishers after simulation") - - -def check_result(result, msg): - from editor_python_test_tools.utils import Report - if not result: - Report.result(msg, False) - raise Exception(msg + " : FAILED") - - -def check_topics(): - import rclpy - from rclpy.node import Node - - def get_topic_list(): - node_dummy = Node("_ros2cli_dummy_to_show_topic_list") - result = node_dummy.get_topic_names_and_types() - node_dummy.destroy_node() - return result - - topics = [] - rclpy.init() - topic_list = get_topic_list() - - for info in topic_list: - topics.append(info[0]) - rclpy.shutdown() - return topics - - -def SmokeTest_EnterGameModeWorks(): - # Description: This test checks that entering into game mode works by opening an empty level - # and entering into the game mode. The is in game mode state should be changed after doing it - # Next it checks if there are some additional ROS topics published during the game mode - - # Import report and test helper utilities - from editor_python_test_tools.utils import Report - from editor_python_test_tools.utils import TestHelper as helper - # All exposed python bindings are in azlmbr - import azlmbr.legacy.general as general - - # Required for automated tests - helper.init_idle() - - # Open the level called "DefaultLevel". - # We use a DefaultLevel level for a smoke test. - # ROS2 System Component should publish topics listed below regardless of level - # - /tf - # - /tf_static - # - /clock - helper.open_level(level="DefaultLevel", directory='') - - topics_before_game_mode = check_topics() - - # Using the exposed Python API from editor in CryEditPy.py we can enter into game mode this way - general.enter_game_mode() - - # The script drives the execution of the test, to return the flow back to the editor, - # we will tick it one time - general.idle_wait_frames(1) - - # Now we can use the Report.result() to report the state of a result - # if the second argument is false, it will mark this test as failed, however it will keep going. - Report.result(Tests.enter_game_mode, general.is_in_game_mode()) - - topics_in_game_mode = check_topics() - - Report.result(Tests.topics_published, len(topics_in_game_mode) > len(topics_before_game_mode)) - - # Instead of using Report.result(), you can also use: - # assert is_in_game_mode, "Didn't enter into game mode" - # However this would stop the test at this point and not report anything when it succeeds - - # The test will end at this point, is good practice to exit game mode or reset any changed stated - # *DO NOT* close the editor, the editor will close automatically and report the error code - general.exit_game_mode() - - # this line is needed to update the simulation state - general.idle_wait_frames(1) - - topics_after_game_mode = check_topics() - Report.result(Tests.topics_not_published_outside_of_game_mode, - len(topics_after_game_mode) == len(topics_before_game_mode)) - - -if __name__ == "__main__": - # This utility starts up the test and sets up the state for knowing what test is currently being run - from editor_python_test_tools.utils import Report - - Report.start_test(SmokeTest_EnterGameModeWorks)