Fixed editor log path and improved editor log not found error string (#5357)
* Fixed editor log path and improved editor log not found error string * Renamed any lowercase editor.log to Editor.log * Fix unit test failures Signed-off-by: AMZN-AlexOteiza <aljanru@amazon.co.uk> Co-authored-by: aljanru <aljanru@uc5564ff5a5ee55.ant.amazon.com>
This commit is contained in:
@@ -165,7 +165,7 @@ class TestAutomationBase:
|
||||
for line in f.readlines():
|
||||
error_str += f"|{log_basename}| {line}"
|
||||
except Exception as ex:
|
||||
error_str += "-- No log available --"
|
||||
error_str += f"-- No log available ({ex})--"
|
||||
|
||||
pytest.fail(error_str)
|
||||
|
||||
|
||||
@@ -378,7 +378,7 @@ class AbstractResourceLocator(object):
|
||||
def editor_log(self):
|
||||
"""
|
||||
Return path to the project's editor log dir using the builds project and platform
|
||||
:return: path to editor.log
|
||||
:return: path to Editor.log
|
||||
"""
|
||||
raise NotImplementedError(
|
||||
"editor_log() is not implemented on the base AbstractResourceLocator() class. "
|
||||
|
||||
@@ -49,9 +49,9 @@ class _LinuxResourceManager(AbstractResourceLocator):
|
||||
|
||||
def editor_log(self):
|
||||
"""
|
||||
:return: path to editor.log
|
||||
:return: path to Editor.log
|
||||
"""
|
||||
return os.path.join(self.project_log(), "editor.log")
|
||||
return os.path.join(self.project_log(), "Editor.log")
|
||||
|
||||
|
||||
class LinuxWorkspaceManager(AbstractWorkspaceManager):
|
||||
|
||||
@@ -58,9 +58,9 @@ class _MacResourceLocator(AbstractResourceLocator):
|
||||
def editor_log(self):
|
||||
"""
|
||||
Return path to the project's editor log dir using the builds project and platform
|
||||
:return: path to editor.log
|
||||
:return: path to Editor.log
|
||||
"""
|
||||
return os.path.join(self.project_log(), "editor.log")
|
||||
return os.path.join(self.project_log(), "Editor.log")
|
||||
|
||||
|
||||
class MacWorkspaceManager(AbstractWorkspaceManager):
|
||||
|
||||
@@ -64,9 +64,9 @@ class _WindowsResourceLocator(AbstractResourceLocator):
|
||||
def editor_log(self):
|
||||
"""
|
||||
Return path to the project's editor log dir using the builds project and platform
|
||||
:return: path to editor.log
|
||||
:return: path to Editor.log
|
||||
"""
|
||||
return os.path.join(self.project_log(), "editor.log")
|
||||
return os.path.join(self.project_log(), "Editor.log")
|
||||
|
||||
|
||||
class WindowsWorkspaceManager(AbstractWorkspaceManager):
|
||||
|
||||
@@ -126,9 +126,9 @@ def retrieve_editor_log_content(run_id: int, log_name: str, workspace: AbstractW
|
||||
with open(editor_log) as f:
|
||||
editor_info = ""
|
||||
for line in f:
|
||||
editor_info += f"[editor.log] {line}"
|
||||
editor_info += f"[{log_name}] {line}"
|
||||
except Exception as ex:
|
||||
editor_info = f"-- Error reading editor.log: {str(ex)} --"
|
||||
editor_info = f"-- Error reading {log_name}: {str(ex)} --"
|
||||
return editor_info
|
||||
|
||||
def retrieve_last_run_test_index_from_output(test_spec_list: list[EditorTestBase], output: str) -> int:
|
||||
|
||||
@@ -119,7 +119,7 @@ class TestEditorTestUtils(unittest.TestCase):
|
||||
mock_log = 'mock log info'
|
||||
|
||||
with mock.patch('builtins.open', mock.mock_open(read_data=mock_log)) as mock_file:
|
||||
assert f'[editor.log] {mock_log}' == editor_test_utils.retrieve_editor_log_content(0, mock_logname, mock_workspace)
|
||||
assert f'[{mock_logname}] {mock_log}' == editor_test_utils.retrieve_editor_log_content(0, mock_logname, mock_workspace)
|
||||
|
||||
@mock.patch('ly_test_tools.o3de.editor_test_utils.retrieve_log_path')
|
||||
@mock.patch('ly_test_tools.environment.waiter.wait_for', mock.MagicMock())
|
||||
@@ -127,7 +127,7 @@ class TestEditorTestUtils(unittest.TestCase):
|
||||
mock_retrieve_log_path.return_value = 'mock_log_path'
|
||||
mock_logname = 'mock_log.log'
|
||||
mock_workspace = mock.MagicMock()
|
||||
expected = f"-- Error reading editor.log"
|
||||
expected = f"-- Error reading {mock_logname}"
|
||||
|
||||
assert expected in editor_test_utils.retrieve_editor_log_content(0, mock_logname, mock_workspace)
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ class TestMacResourceLocator(object):
|
||||
mock_project)
|
||||
expected = os.path.join(
|
||||
mac_resource_locator.project_log(),
|
||||
'editor.log')
|
||||
'Editor.log')
|
||||
|
||||
assert mac_resource_locator.editor_log() == expected
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ class TestWindowsResourceLocator(object):
|
||||
mock_build_directory, mock_project)
|
||||
expected = os.path.join(
|
||||
windows_resource_locator.project_log(),
|
||||
'editor.log')
|
||||
'Editor.log')
|
||||
|
||||
assert windows_resource_locator.editor_log() == expected
|
||||
|
||||
|
||||
Reference in New Issue
Block a user