From 14b2b7dfdbc0bd18cbb35f9b0bc209c14690e977 Mon Sep 17 00:00:00 2001 From: darapan Date: Fri, 14 May 2021 03:36:21 -0700 Subject: [PATCH] "Fixing review comments" --- .../smoke/Editor_NewExistingLevels_Works.py | 5 +---- .../smoke/test_CLITool_AssetBuilder_Works.py | 16 +++------------- .../test_CLITool_AssetBundlerBatch_Works.py | 16 +++------------- .../test_CLITool_AssetProcessorBatch_Works.py | 5 ++--- .../smoke/test_CLITool_AzTestRunner_Works.py | 16 +++------------- .../test_CLITool_PythonBindingsExample_Works.py | 16 +++------------- .../test_CLITool_SerializeContextTools_Works.py | 16 +++------------- .../smoke/test_Editor_NewExistingLevels_Works.py | 4 ---- .../test_StaticTools_GenPakShaders_Works.py | 6 ++---- .../test_UIApps_AssetProcessor_CheckIdle.py | 4 +--- 10 files changed, 21 insertions(+), 83 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/smoke/Editor_NewExistingLevels_Works.py b/AutomatedTesting/Gem/PythonTests/smoke/Editor_NewExistingLevels_Works.py index ce46da494c..db0284f14c 100644 --- a/AutomatedTesting/Gem/PythonTests/smoke/Editor_NewExistingLevels_Works.py +++ b/AutomatedTesting/Gem/PythonTests/smoke/Editor_NewExistingLevels_Works.py @@ -13,7 +13,6 @@ Test Case Title: Create Test for UI apps- Editor """ -# fmt: off class Tests(): level_created = ("Level created", "Failed to create level") entity_found = ("New Entity created in level", "Failed to create New Entity in level") @@ -25,7 +24,6 @@ class Tests(): mesh_removed = ("Mesh Component removed", "Failed to remove Mesh Component") entity_deleted = ("Entity deleted", "Failed to delete Entity") level_edits_present = ("Level edits persist after saving", "Failed to save level edits after saving") -# fmt: on def Editor_NewExistingLevels_Works(): @@ -79,7 +77,7 @@ def Editor_NewExistingLevels_Works(): helper.init_idle() test_level_name = "temp_level" general.create_level_no_prompt(test_level_name, 128, 1, 128, False) - general.idle_wait(2.0) + helper.wait_for_condition(lambda: general.get_current_level_name() == test_level_name, 2.0) Report.result(Tests.level_created, general.get_current_level_name() == test_level_name) # 2) Create a new entity @@ -104,7 +102,6 @@ def Editor_NewExistingLevels_Works(): general.open_level(test_level_name) Report.result(Tests.level_opened, general.get_current_level_name() == test_level_name) # Export Level - general.idle_wait(1.0) general.export_to_engine() level_pak_file = os.path.join("AutomatedTesting", "Levels", test_level_name, "level.pak") Report.result(Tests.level_exported, os.path.exists(level_pak_file)) diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AssetBuilder_Works.py b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AssetBuilder_Works.py index e20809b1b8..34655bba0e 100644 --- a/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AssetBuilder_Works.py +++ b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AssetBuilder_Works.py @@ -7,9 +7,8 @@ distribution (the "License"). All use of this software is governed by the Licens or, if provided, by the license below or the license accompanying this file. Do not remove or modify any license notices. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -""" -""" + CLI tool - AssetBuilder Launch AssetBuilder and Verify the help message """ @@ -17,21 +16,12 @@ Launch AssetBuilder and Verify the help message import os import pytest import subprocess -import ly_test_tools.environment.process_utils as process_utils -@pytest.mark.parametrize("project", ["AutomatedTesting"]) -@pytest.mark.usefixtures("automatic_process_killer") +@pytest.mark.timeout(10) @pytest.mark.SUITE_smoke class TestCLIToolAssetBuilderWorks(object): - @pytest.fixture(autouse=True) - def setup_teardown(self, request): - def teardown(): - process_utils.kill_processes_named("AssetBuilder", True) - - request.addfinalizer(teardown) - - def test_CLITool_AssetBuilder_Works(self, request, editor, build_directory): + def test_CLITool_AssetBuilder_Works(self, build_directory): file_path = os.path.join(build_directory, "AssetBuilder") help_message = "AssetBuilder is part of the Asset Processor" # Launch AssetBuilder diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AssetBundlerBatch_Works.py b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AssetBundlerBatch_Works.py index 8a20715b3f..006e785bd8 100644 --- a/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AssetBundlerBatch_Works.py +++ b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AssetBundlerBatch_Works.py @@ -7,9 +7,8 @@ distribution (the "License"). All use of this software is governed by the Licens or, if provided, by the license below or the license accompanying this file. Do not remove or modify any license notices. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -""" -""" + CLI tool - AssetBundlerBatch Launch AssetBundlerBatch and Verify the help message """ @@ -17,21 +16,12 @@ Launch AssetBundlerBatch and Verify the help message import os import pytest import subprocess -import ly_test_tools.environment.process_utils as process_utils -@pytest.mark.parametrize("project", ["AutomatedTesting"]) -@pytest.mark.usefixtures("automatic_process_killer") +@pytest.mark.timeout(10) @pytest.mark.SUITE_smoke class TestCLIToolAssetBundlerBatchWorks(object): - @pytest.fixture(autouse=True) - def setup_teardown(self, request): - def teardown(): - process_utils.kill_processes_named("AssetBundlerBatch", True) - - request.addfinalizer(teardown) - - def test_CLITool_AssetBundlerBatch_Works(self, request, editor, build_directory): + def test_CLITool_AssetBundlerBatch_Works(self, build_directory): file_path = os.path.join(build_directory, "AssetBundlerBatch") help_message = "Specifies the Seed List file to operate on by path" # Launch AssetBundlerBatch diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AssetProcessorBatch_Works.py b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AssetProcessorBatch_Works.py index 30e681050c..8a99082f08 100644 --- a/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AssetProcessorBatch_Works.py +++ b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AssetProcessorBatch_Works.py @@ -7,9 +7,8 @@ distribution (the "License"). All use of this software is governed by the Licens or, if provided, by the license below or the license accompanying this file. Do not remove or modify any license notices. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -""" -""" + CLI tool - AssetProcessorBatch Launch AssetProcessorBatch and Shutdown AssetProcessorBatch without any crash """ @@ -21,7 +20,7 @@ from ly_test_tools.o3de.asset_processor import AssetProcessor @pytest.mark.parametrize("project", ["AutomatedTesting"]) -@pytest.mark.usefixtures("automatic_process_killer") +@pytest.mark.timeout(10) @pytest.mark.SUITE_smoke class TestsCLIToolAssetProcessorBatchWorks(object): def test_CLITool_AssetProcessorBatch_Works(self, workspace): diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AzTestRunner_Works.py b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AzTestRunner_Works.py index 5983cd7496..6a9ec4f8d9 100644 --- a/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AzTestRunner_Works.py +++ b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_AzTestRunner_Works.py @@ -7,9 +7,8 @@ distribution (the "License"). All use of this software is governed by the Licens or, if provided, by the license below or the license accompanying this file. Do not remove or modify any license notices. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -""" -""" + CLI tool - AzTestRunner Launch AzTestRunner and Verify the help message """ @@ -17,21 +16,12 @@ Launch AzTestRunner and Verify the help message import os import pytest import subprocess -import ly_test_tools.environment.process_utils as process_utils -@pytest.mark.parametrize("project", ["AutomatedTesting"]) -@pytest.mark.usefixtures("automatic_process_killer") +@pytest.mark.timeout(10) @pytest.mark.SUITE_smoke class TestCLIToolAzTestRunnerWorks(object): - @pytest.fixture(autouse=True) - def setup_teardown(self, request): - def teardown(): - process_utils.kill_processes_named("AzTestRunner", True) - - request.addfinalizer(teardown) - - def test_CLITool_AzTestRunner_Works(self, request, editor, build_directory): + def test_CLITool_AzTestRunner_Works(self, build_directory): file_path = os.path.join(build_directory, "AzTestRunner") help_message = "OKAY Symbol found: AzRunUnitTests" # Launch AzTestRunner diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_PythonBindingsExample_Works.py b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_PythonBindingsExample_Works.py index 68d12d0e70..6e343d9518 100644 --- a/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_PythonBindingsExample_Works.py +++ b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_PythonBindingsExample_Works.py @@ -7,9 +7,8 @@ distribution (the "License"). All use of this software is governed by the Licens or, if provided, by the license below or the license accompanying this file. Do not remove or modify any license notices. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -""" -""" + CLI tool - PythonBindingsExample Launch PythonBindingsExample and Verify the help message """ @@ -17,21 +16,12 @@ Launch PythonBindingsExample and Verify the help message import os import pytest import subprocess -import ly_test_tools.environment.process_utils as process_utils -@pytest.mark.parametrize("project", ["AutomatedTesting"]) -@pytest.mark.usefixtures("automatic_process_killer") +@pytest.mark.timeout(10) @pytest.mark.SUITE_smoke class TestCLIToolPythonBindingsExampleWorks(object): - @pytest.fixture(autouse=True) - def setup_teardown(self, request): - def teardown(): - process_utils.kill_processes_named("PythonBindingsExample", True) - - request.addfinalizer(teardown) - - def test_CLITool_PythonBindingsExample_Works(self, request, editor, build_directory): + def test_CLITool_PythonBindingsExample_Works(self, build_directory): file_path = os.path.join(build_directory, "PythonBindingsExample") help_message = "--help Prints the help text" # Launch PythonBindingsExample diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_SerializeContextTools_Works.py b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_SerializeContextTools_Works.py index 94178ca9d6..216a03013b 100644 --- a/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_SerializeContextTools_Works.py +++ b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_SerializeContextTools_Works.py @@ -7,9 +7,8 @@ distribution (the "License"). All use of this software is governed by the Licens or, if provided, by the license below or the license accompanying this file. Do not remove or modify any license notices. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -""" -""" + CLI tool - SerializeContextTools Launch SerializeContextTools and Verify the help message """ @@ -17,21 +16,12 @@ Launch SerializeContextTools and Verify the help message import os import pytest import subprocess -import ly_test_tools.environment.process_utils as process_utils -@pytest.mark.parametrize("project", ["AutomatedTesting"]) -@pytest.mark.usefixtures("automatic_process_killer") +@pytest.mark.timeout(10) @pytest.mark.SUITE_smoke class TestCLIToolSerializeContextToolsWorks(object): - @pytest.fixture(autouse=True) - def setup_teardown(self, request): - def teardown(): - process_utils.kill_processes_named("SerializeContextTools", True) - - request.addfinalizer(teardown) - - def test_CLITool_SerializeContextTools_Works(self, request, editor, build_directory): + def test_CLITool_SerializeContextTools_Works(self, build_directory): file_path = os.path.join(build_directory, "SerializeContextTools") help_message = "Converts a file with an ObjectStream to the new JSON" # Launch SerializeContextTools diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_Editor_NewExistingLevels_Works.py b/AutomatedTesting/Gem/PythonTests/smoke/test_Editor_NewExistingLevels_Works.py index 510734a4a2..985740307f 100644 --- a/AutomatedTesting/Gem/PythonTests/smoke/test_Editor_NewExistingLevels_Works.py +++ b/AutomatedTesting/Gem/PythonTests/smoke/test_Editor_NewExistingLevels_Works.py @@ -11,10 +11,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. import pytest import os -import sys - -sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../automatedtesting_shared") - from automatedtesting_shared.base import TestAutomationBase import ly_test_tools.environment.file_system as file_system diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_StaticTools_GenPakShaders_Works.py b/AutomatedTesting/Gem/PythonTests/smoke/test_StaticTools_GenPakShaders_Works.py index 05b91a602d..42cb3afb00 100644 --- a/AutomatedTesting/Gem/PythonTests/smoke/test_StaticTools_GenPakShaders_Works.py +++ b/AutomatedTesting/Gem/PythonTests/smoke/test_StaticTools_GenPakShaders_Works.py @@ -7,9 +7,8 @@ distribution (the "License"). All use of this software is governed by the Licens or, if provided, by the license below or the license accompanying this file. Do not remove or modify any license notices. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -""" -""" + Static tool scripts Launch Static tool and Verify the help message """ @@ -32,10 +31,9 @@ def verify_help_message(static_tool): @pytest.mark.parametrize("project", ["AutomatedTesting"]) -@pytest.mark.usefixtures("automatic_process_killer") @pytest.mark.SUITE_smoke class TestStaticToolsGenPakShadersWorks(object): - def test_StaticTools_GenPakShaders_Works(self, request, editor): + def test_StaticTools_GenPakShaders_Works(self, editor): static_tools = [ os.path.join(editor.workspace.paths.engine_root(), "scripts", "bundler", "gen_shaders.py"), os.path.join(editor.workspace.paths.engine_root(), "scripts", "bundler", "get_shader_list.py"), diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_UIApps_AssetProcessor_CheckIdle.py b/AutomatedTesting/Gem/PythonTests/smoke/test_UIApps_AssetProcessor_CheckIdle.py index 0f5f870461..4b039adea8 100644 --- a/AutomatedTesting/Gem/PythonTests/smoke/test_UIApps_AssetProcessor_CheckIdle.py +++ b/AutomatedTesting/Gem/PythonTests/smoke/test_UIApps_AssetProcessor_CheckIdle.py @@ -7,9 +7,8 @@ distribution (the "License"). All use of this software is governed by the Licens or, if provided, by the license below or the license accompanying this file. Do not remove or modify any license notices. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -""" -""" + UI Apps: AssetProcessor Open AssetProcessor, Wait until AssetProcessor is Idle Close AssetProcessor. @@ -21,7 +20,6 @@ from ly_test_tools.o3de.asset_processor import AssetProcessor @pytest.mark.parametrize("project", ["AutomatedTesting"]) -@pytest.mark.usefixtures("automatic_process_killer") @pytest.mark.SUITE_smoke class TestsUIAppsAssetProcessorCheckIdle(object): @pytest.fixture(autouse=True)