Merge pull request #5775 from aws-lumberyard-dev/test_artifact_collection

LyTestTools artifact collection
This commit is contained in:
Sean Sweeney
2021-12-03 10:57:50 -08:00
committed by GitHub
4 changed files with 6 additions and 14 deletions
@@ -153,7 +153,6 @@ class Launcher(object):
:return: None
"""
self.workspace.asset_processor.stop()
self.save_project_log_files()
def save_project_log_files(self):
# type: () -> None
@@ -48,6 +48,7 @@ import ly_test_tools.environment.waiter as waiter
import ly_test_tools.environment.process_utils as process_utils
import ly_test_tools.o3de.editor_test
import ly_test_tools.o3de.editor_test_utils as editor_utils
import ly_test_tools._internal.pytest_plugin
from ly_test_tools.o3de.asset_processor import AssetProcessor
from ly_test_tools.launchers.exceptions import WaitTimeoutError
@@ -757,7 +758,7 @@ class EditorTestSuite():
cmdline = [
"--runpythontest", test_filename,
"-logfile", f"@log@/{log_name}",
"-project-log-path", editor_utils.retrieve_log_path(run_id, workspace)] + test_cmdline_args
"-project-log-path", ly_test_tools._internal.pytest_plugin.output_path] + test_cmdline_args
editor.args.extend(cmdline)
editor.start(backupFiles = False, launch_ap = False, configure_settings=False)
@@ -823,7 +824,7 @@ class EditorTestSuite():
cmdline = [
"--runpythontest", test_filenames_str,
"-logfile", f"@log@/{log_name}",
"-project-log-path", editor_utils.retrieve_log_path(run_id, workspace)] + test_cmdline_args
"-project-log-path", ly_test_tools._internal.pytest_plugin.output_path] + test_cmdline_args
editor.args.extend(cmdline)
editor.start(backupFiles = False, launch_ap = False, configure_settings=False)
@@ -900,7 +901,6 @@ class EditorTestSuite():
results[test_spec_name] = Result.Timeout.create(timed_out_result.test_spec,
results[test_spec_name].output,
self.timeout_editor_shared_test, result.editor_log)
return results
def _run_single_test(self, request: Request, workspace: AbstractWorkspace, editor: Editor,
@@ -146,15 +146,6 @@ class TestBaseLauncher:
mock_stop_ap.assert_called_once()
@mock.patch('ly_test_tools.launchers.platforms.base.Launcher.save_project_log_files')
def test_Teardown_TeardownCalled_CallsSaveProjectLogFiles(self, under_test):
mock_workspace = mock.MagicMock()
mock_args = ['foo']
mock_launcher = ly_test_tools.launchers.Launcher(mock_workspace, mock_args)
mock_launcher.teardown()
under_test.assert_called_once()
@mock.patch('os.path.exists', mock.MagicMock(return_value=True))
@mock.patch('ly_test_tools._internal.managers.artifact_manager.ArtifactManager.save_artifact')
@mock.patch('os.listdir')
+3 -1
View File
@@ -32,6 +32,7 @@ endif()
# Set and create folders for PyTest and GTest xml output
ly_set(PYTEST_XML_OUTPUT_DIR ${CMAKE_BINARY_DIR}/Testing/Pytest)
ly_set(GTEST_XML_OUTPUT_DIR ${CMAKE_BINARY_DIR}/Testing/Gtest)
ly_set(LYTESTTOOLS_OUTPUT_DIR ${CMAKE_BINARY_DIR}/Testing/LyTestTools)
file(MAKE_DIRECTORY ${PYTEST_XML_OUTPUT_DIR})
file(MAKE_DIRECTORY ${GTEST_XML_OUTPUT_DIR})
@@ -309,6 +310,7 @@ function(ly_add_pytest)
endif()
string(REPLACE "::" "_" pytest_report_directory "${PYTEST_XML_OUTPUT_DIR}/${ly_add_pytest_NAME}.xml")
string(REPLACE "::" "_" pytest_output_directory "${LYTESTTOOLS_OUTPUT_DIR}/${ly_add_pytest_NAME}")
# Add the script path to the test target params
set(LY_TEST_PARAMS "${ly_add_pytest_PATH}")
@@ -318,7 +320,7 @@ function(ly_add_pytest)
PARENT_NAME ${ly_add_pytest_NAME}
TEST_SUITE ${ly_add_pytest_TEST_SUITE}
LABELS FRAMEWORK_pytest
TEST_COMMAND ${LY_PYTEST_EXECUTABLE} ${ly_add_pytest_PATH} ${ly_add_pytest_EXTRA_ARGS} --junitxml=${pytest_report_directory} ${custom_marks_args}
TEST_COMMAND ${LY_PYTEST_EXECUTABLE} ${ly_add_pytest_PATH} ${ly_add_pytest_EXTRA_ARGS} --output-path ${pytest_output_directory} --junitxml=${pytest_report_directory} ${custom_marks_args}
TEST_LIBRARY pytest
COMPONENT ${ly_add_pytest_COMPONENT}
${ly_add_pytest_UNPARSED_ARGUMENTS}