conftest.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. pytest test configuration file for launching AtomSampleViewerStandalone tests.
  10. """
  11. import logging
  12. import os
  13. import pytest
  14. import ly_test_tools.builtin.helpers as helpers
  15. import ly_test_tools.environment.file_system as file_system
  16. logger = logging.getLogger(__name__)
  17. @pytest.fixture(scope="function", autouse=True)
  18. def clean_atomsampleviewer_logs(request, workspace):
  19. """Deletes any AtomSampleViewer log files so that the test run can start with empty logs."""
  20. logs = ['atomsampleviewer.log']
  21. logger.info(f'Deleting log files for AtomSampleViewer tests: {logs}')
  22. for log in logs:
  23. log_file = os.path.join(workspace.paths.project_log(), log)
  24. if os.path.exists(log_file):
  25. file_system.delete(file_list=[log_file],
  26. del_files=True,
  27. del_dirs=False)
  28. @pytest.fixture(scope="function", autouse=True)
  29. def setup_atomsampleviewer_assets(project, workspace):
  30. """Sets up bootstrap.cfg to target AtomSampleViewer before starting the tests (prevents AssetProcessor errors)."""
  31. helpers.setup_bootstrap_project(workspace, project)