Integrating up through commit 90f050496

This commit is contained in:
alexpete
2021-04-07 14:03:29 -07:00
parent 8f2ed080a9
commit c2cbd430fe
2694 changed files with 285622 additions and 176874 deletions
@@ -51,7 +51,7 @@ def remote_console(request):
# Shared parameters & fixtures for all test methods inside the TestSystemExample class.
@pytest.mark.usefixtures("automatic_process_killer")
@pytest.mark.parametrize('project', ['SamplesProject'])
@pytest.mark.parametrize('project', ['AutomatedTesting'])
class TestSystemExample(object):
"""
Example test case class to hold a set of test case methods.
@@ -68,11 +68,11 @@ class TestSystemExample(object):
@pytest.mark.parametrize('level', ['simple_jacklocomotion'])
@pytest.mark.parametrize('load_wait', [120])
@pytest.mark.test_case_id('C16806863')
def test_SystemTestExample_AllSupportedPlatforms_LaunchSamplesProject(
def test_SystemTestExample_AllSupportedPlatforms_LaunchAutomatedTesting(
# launcher_platform, asset_processor_platform, # Re-add these here if you plan to use them.
self, launcher, remote_console, level, load_wait):
"""
Tests launching the SamplesProject then launches the Lumberyard client &
Tests launching the AutomatedTesting then launches the Lumberyard client &
loads the "simple_jacklocomotion" level using the remote console.
Assumes the user already setup & built their machine for the test.
"""
@@ -22,7 +22,6 @@ import pytest
import ly_test_tools._internal.managers.artifact_manager
pytestmark = pytest.mark.SUITE_smoke
TIMESTAMP_FORMAT = '%Y-%m-%dT%H-%M-%S-%f'
DATE = datetime.datetime.now().strftime(TIMESTAMP_FORMAT)
@@ -61,6 +61,7 @@ class TestAssetProcessor(object):
assert under_test._ap_proc is not None
mock_popen.assert_called_once_with([mock_ap_path, '--zeroAnalysisMode', '--regset="/Amazon/AzCore/Bootstrap/project_path=AutomatedTesting"',
'--logDir', under_test.log_root(),
'--acceptInput', '--platforms', 'bar'], cwd=os.path.dirname(mock_ap_path))
mock_connect.assert_called()
@@ -68,7 +69,8 @@ class TestAssetProcessor(object):
@mock.patch('subprocess.Popen')
@mock.patch('os.path.basename', mock.MagicMock(return_value=""))
@mock.patch('os.path.dirname', mock.MagicMock(return_value=""))
@mock.patch('ly_test_tools.environment.process_utils.kill_processes_with_name_not_started_from', mock.MagicMock(return_value=None))
@mock.patch('ly_test_tools.environment.process_utils.kill_processes_with_name_not_started_from',
mock.MagicMock(return_value=None))
@mock.patch('ly_test_tools.environment.process_utils.process_exists', mock.MagicMock(return_value=True))
@mock.patch('socket.socket.connect')
def test_Start_ProcAlreadyRunning_ProcNotChanged(self, mock_connect, mock_popen, mock_workspace):
@@ -101,7 +103,6 @@ class TestAssetProcessor(object):
mock_waiter.assert_called_once()
assert under_test._ap_proc is None
@mock.patch('ly_test_tools._internal.managers.workspace.AbstractWorkspaceManager')
@mock.patch('subprocess.run')
def test_BatchProcess_NoFastscanBatchCompletes_Success(self, mock_run, mock_workspace):
@@ -112,7 +113,8 @@ class TestAssetProcessor(object):
result, _ = under_test.batch_process(1, False)
assert result
mock_run.assert_called_once_with([apb_path], close_fds=True, capture_output=False,
mock_run.assert_called_once_with([apb_path, '--logDir', under_test.log_root()],
close_fds=True, capture_output=False,
timeout=1)
@mock.patch('ly_test_tools._internal.managers.workspace.AbstractWorkspaceManager')
@@ -126,9 +128,13 @@ class TestAssetProcessor(object):
result = under_test.batch_process(1, True)
assert result
mock_run.assert_called_once_with([apb_path, '--zeroAnalysisMode', '--regset="/Amazon/AzCore/Bootstrap/project_path=AutomatedTesting"'],
close_fds=True, capture_output=False,
timeout=1)
mock_run.assert_called_once_with(
[apb_path, '--zeroAnalysisMode', '--regset="/Amazon/AzCore/Bootstrap/project_path=AutomatedTesting"',
'--logDir',
under_test.log_root()],
close_fds=True, capture_output=False,
timeout=1)
@mock.patch('ly_test_tools._internal.managers.workspace.AbstractWorkspaceManager')
@mock.patch('subprocess.run')
@@ -141,8 +147,8 @@ class TestAssetProcessor(object):
result, _ = under_test.batch_process(None, False)
assert not result
mock_run.assert_called_once_with([apb_path], close_fds=True, capture_output=False, timeout=28800.0)
mock_run.assert_called_once_with([apb_path, '--logDir', under_test.log_root()],
close_fds=True, capture_output=False, timeout=28800.0)
@mock.patch('ly_test_tools._internal.managers.workspace.AbstractWorkspaceManager')
def test_EnableAssetProcessorPlatform_AssetProcessorObject_Updated(self, mock_workspace):
@@ -181,5 +187,3 @@ class TestAssetProcessor(object):
mock_stop.assert_called()
mock_restore_ap.assert_called()
@@ -138,9 +138,9 @@ class TestFixtures(object):
@mock.patch("ly_test_tools.builtin.helpers.create_builtin_workspace")
def test_Workspace_MockFixturesAndExecTeardown_ReturnWorkspaceRegisterTeardown(self, mock_create, mock_setup):
test_module = 'example.tests.test_system_example'
test_class = ('TestSystemExample.test_SystemTestExample_AllSupportedPlatforms_LaunchSamplesProject'
'[120-simple_jacklocomotion-SamplesProject-all-profile-win_x64_vs2017]')
test_method = 'test_SystemTestExample_AllSupportedPlatforms_LaunchSamplesProject'
test_class = ('TestSystemExample.test_SystemTestExample_AllSupportedPlatforms_LaunchAutomatedTesting'
'[120-simple_jacklocomotion-AutomatedTesting-all-profile-win_x64_vs2017]')
test_method = 'test_SystemTestExample_AllSupportedPlatforms_LaunchAutomatedTesting'
artifact_folder_name = 'TheArtifactFolder'
artifact_path = "PathToArtifacts"
@@ -183,7 +183,7 @@ class TestFixtures(object):
mock_workspace.artifact_manager.generate_folder_name.assert_called_with(
test_module.split('.')[-1], # 'example.tests.test_system_example' -> 'test_system_example'
test_class.split('.')[0], # 'TestSystemExample.test_SystemTestExample_...' -> 'TestSystemExample'
test_method # 'test_SystemTestExample_AllSupportedPlatforms_LaunchSamplesProject'
test_method # 'test_SystemTestExample_AllSupportedPlatforms_LaunchAutomatedTesting'
)
@mock.patch('os.path.exists', mock.MagicMock(return_value=True))