Updating base.py to allow for turning off batch and autotest modes

Signed-off-by: jckand-amzn <jckand@amazon.com>
This commit is contained in:
jckand-amzn
2021-08-20 16:29:48 -05:00
parent 7daef6ab03
commit 182d410562
3 changed files with 17 additions and 10 deletions
@@ -51,8 +51,8 @@ class TestAutomationBase:
cls.asset_processor.teardown()
cls._kill_ly_processes()
def _run_test(self, request, workspace, editor, testcase_module, extra_cmdline_args=[], use_null_renderer=True):
def _run_test(self, request, workspace, editor, testcase_module, extra_cmdline_args=[], batch_mode=True,
autotest_mode=True, use_null_renderer=True):
test_starttime = time.time()
self.logger = logging.getLogger(__name__)
errors = []
@@ -90,9 +90,13 @@ class TestAutomationBase:
editor_starttime = time.time()
self.logger.debug("Running automated test")
testcase_module_filepath = self._get_testcase_module_filepath(testcase_module)
pycmd = ["--runpythontest", testcase_module_filepath, "-BatchMode", "-autotest_mode", f"-pythontestcase={request.node.originalname}"]
pycmd = ["--runpythontest", testcase_module_filepath, f"-pythontestcase={request.node.originalname}"]
if use_null_renderer:
pycmd += ["-rhi=null"]
if batch_mode:
pycmd += ["-BatchMode"]
if autotest_mode:
pycmd += ["-autotest_mode"]
pycmd += extra_cmdline_args
editor.args.extend(pycmd) # args are added to the WinLauncher start command
editor.start(backupFiles = False, launch_ap = False)
@@ -37,12 +37,12 @@ class Tests:
)
def RunTest():
def BasicEditorWorkflows_LevelEntityComponentCRUD():
import editor_python_test_tools.pyside_utils as pyside_utils
@pyside_utils.wrap_async
async def BasicEditorWorkflows_LevelEntityComponentCRUD():
async def run_test():
"""
Summary:
Open O3DE editor and check if basic Editor workflows are completable.
@@ -139,7 +139,8 @@ def RunTest():
# Update the component
dimensions_to_set = math.Vector3(16.0, 16.0, 16.0)
child_entity.get_set_test(0, "Box Shape|Box Configuration|Dimensions", dimensions_to_set)
box_shape_dimensions = hydra.get_component_property_value(child_entity.components[0], "Box Shape|Box Configuration|Dimensions")
box_shape_dimensions = hydra.get_component_property_value(child_entity.components[0],
"Box Shape|Box Configuration|Dimensions")
Report.result(Tests.component_updated, box_shape_dimensions == dimensions_to_set)
# Remove the component
@@ -161,10 +162,10 @@ def RunTest():
export_success = await pyside_utils.wait_for_condition(lambda: os.path.exists(level_pak_file), 5.0)
Report.result(Tests.level_saved_and_exported, export_success)
BasicEditorWorkflows_LevelEntityComponentCRUD()
run_test()
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(RunTest)
Report.start_test(BasicEditorWorkflows_LevelEntityComponentCRUD)
@@ -20,6 +20,7 @@ class TestAutomation(EditorTestSuite):
class test_BasicEditorWorkflows_LevelEntityComponentCRUD(EditorSingleTest):
# Disable -BatchMode and -autotest_mode
EditorTestSuite.global_extra_cmdline_args = []
# Custom teardown to remove slice asset created during test
def teardown(self, request, workspace, editor, editor_test_results, launcher_platform):
file_system.delete([os.path.join(workspace.paths.engine_root(), "AutomatedTesting", "Levels", "tmp_level")],
@@ -30,9 +31,10 @@ class TestAutomation(EditorTestSuite):
class test_BasicEditorWorkflows_GPU_LevelEntityComponentCRUD(EditorSingleTest):
# Disable -BatchMode, -autotest_mode, and null renderer
EditorTestSuite.global_extra_cmdline_args = []
use_null_renderer = False
EditorTestSuite.use_null_renderer = False
# Custom teardown to remove slice asset created during test
def teardown(self, request, workspace, editor, editor_test_results, launcher_platform):
file_system.delete([os.path.join(workspace.paths.engine_root(), "AutomatedTesting", "Levels", "tmp_level")],
True, True)
from .EditorScripts import BasicEditorWorkflows_LevelEntityComponentCRUD as test_module
from .EditorScripts import BasicEditorWorkflows_LevelEntityComponentCRUD as test_module