Files
o3de/AutomatedTesting/Gem/PythonTests/EditorPythonBindings/hydra_utils.py
T
Steve Pham b4a2edec6a Final update copyright headers to reference license files at the repo root (#1693)
* Final update copyright headers to reference license files at the repo root

Signed-off-by: spham <spham@amazon.com>

* Fix copyright validator unit tests to support the stale O3DE header scenario

Signed-off-by: spham <spham@amazon.com>
2021-06-30 19:51:55 -07:00

58 lines
2.4 KiB
Python
Executable File

"""
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
"""
#
# Helpful functions to simplify running the Hydra tests
#
import pytest
pytest.importorskip('ly_test_tools')
import os
import ly_test_tools.log.log_monitor
import ly_test_tools.environment.waiter as waiter
import logging
logger = logging.getLogger(__name__)
def launch_test_case(editor, test_case, expected_lines, unexpected_lines):
timeout=180
halt_on_unexpected=False
logger.debug("Running automated test: {}".format(test_case))
editor.args.extend(['-NullRenderer', "--skipWelcomeScreenDialog", "--autotest_mode", "--runpythontest", test_case])
print ('editor.args = {}'.format(editor.args))
with editor.start():
editorlog_file = os.path.join(editor.workspace.paths.project_log(), 'Editor.log')
log_monitor = ly_test_tools.log.log_monitor.LogMonitor(editor, editorlog_file)
logger.debug("Waiting for log file '{}' to be opened by another process.".format(editorlog_file))
waiter.wait_for(
lambda: editor.is_alive(),
timeout,
exc=("Log file '{}' was never opened by another process.".format(editorlog_file)),
interval=1)
log_monitor.monitor_log_for_lines(expected_lines, unexpected_lines, halt_on_unexpected, timeout)
def launch_test_case_with_args(editor, test_case, expected_lines, unexpected_lines, extra_args):
timeout=180
halt_on_unexpected=False
logger.debug("Running automated test: {}".format(test_case))
editor.args.extend(['-NullRenderer', "--skipWelcomeScreenDialog", "--autotest_mode", "--runpythontest", test_case, '--runpythonargs'])
editor.args.extend(extra_args)
print ('editor.args = {}'.format(editor.args))
with editor.start():
editorlog_file = os.path.join(editor.workspace.paths.project_log(), 'Editor.log')
log_monitor = ly_test_tools.log.log_monitor.LogMonitor(editor, editorlog_file)
logger.debug("Waiting for log file '{}' to be opened by another process.".format(editorlog_file))
waiter.wait_for(
lambda: editor.is_alive(),
timeout,
exc=("Log file '{}' was never opened by another process.".format(editorlog_file)),
interval=1)
log_monitor.monitor_log_for_lines(expected_lines, unexpected_lines, halt_on_unexpected, timeout)