test_LayerBlocker.py 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. """
  2. All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
  3. its licensors.
  4. For complete copyright and license terms please see the LICENSE at the root of this
  5. distribution (the "License"). All use of this software is governed by the License,
  6. or, if provided, by the license below or the license accompanying this file. Do not
  7. remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. """
  10. import os
  11. import pytest
  12. import logging
  13. # Bail on the test if ly_test_tools doesn't exist.
  14. pytest.importorskip('ly_test_tools')
  15. import ly_test_tools.environment.file_system as file_system
  16. import automatedtesting_shared.hydra_test_utils as hydra
  17. logger = logging.getLogger(__name__)
  18. test_directory = os.path.join(os.path.dirname(__file__), 'EditorScripts')
  19. @pytest.mark.parametrize("project", ["AutomatedTesting"])
  20. @pytest.mark.parametrize("level", ["tmp_level"])
  21. @pytest.mark.usefixtures("automatic_process_killer")
  22. @pytest.mark.parametrize("launcher_platform", ['windows_editor'])
  23. class TestLayerBlocker(object):
  24. @pytest.fixture(autouse=True)
  25. def setup_teardown(self, request, workspace, project, level):
  26. def teardown():
  27. file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
  28. request.addfinalizer(teardown)
  29. file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
  30. @pytest.mark.test_case_id("C2793772")
  31. @pytest.mark.SUITE_periodic
  32. def test_LayerBlocker_InstancesBlockedInConfiguredArea(self, request, editor, level, launcher_platform):
  33. expected_lines = [
  34. "'Instance Spawner' created",
  35. "'Surface Entity' created",
  36. "instance count validation: True (found=400, expected=400)",
  37. "'Blocker Area' created",
  38. "instance count validation: True (found=384, expected=384)",
  39. "LayerBlocker_InstancesBlocked: result=SUCCESS"
  40. ]
  41. hydra.launch_and_validate_results(
  42. request,
  43. test_directory,
  44. editor,
  45. "LayerBlocker_InstancesBlockedInConfiguredArea.py",
  46. expected_lines,
  47. cfg_args=[level]
  48. )