clear_testingAssets_dir.py 955 B

12345678910111213141516171819202122232425262728293031323334
  1. """
  2. Copyright (c) Contributors to the Open 3D Engine Project.
  3. For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. SPDX-License-Identifier: Apache-2.0 OR MIT
  5. Fixture for clearing "testingAssets" directory from <build>/dev/<project>
  6. """
  7. # Import builtin libraries
  8. import os
  9. import pytest
  10. # Import LyTestTools
  11. import ly_test_tools.environment.file_system as fs
  12. # Import fixtures
  13. from ..ap_fixtures.ap_setup_fixture import ap_setup_fixture as ap_setup_fixture
  14. @pytest.fixture
  15. def clear_testingAssets_dir(request, workspace, ap_setup_fixture) -> None:
  16. env = ap_setup_fixture
  17. testingAssets_dir = os.path.join(env["project_dir"], "testingAssets")
  18. def remove_testingAssets_dir():
  19. fs.delete([testingAssets_dir], False, True)
  20. # Delete the directory upon execution
  21. remove_testingAssets_dir()
  22. # Delete the directory on teardown
  23. request.addfinalizer(remove_testingAssets_dir)