custom_pytest.cmake 1.4 KB

1234567891011121314151617181920212223242526272829
  1. # {BEGIN_LICENSE}
  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. #
  5. # SPDX-License-Identifier: Apache-2.0 OR MIT
  6. #
  7. # {END_LICENSE}
  8. # Include this file in your Project/Gem/CMakeLists.txt using "include(Tests/custom_pytest.cmake)" at the end.
  9. # Add a cache variable or set -DDISABLE_GEM_TESTS=ON to disable tests for this gem
  10. # PAL_TRAIT_TEST_PYTEST_SUPPORTED is defined in the O3DE CMake code and will be
  11. # FALSE if the current platform (like IOS for example) does not support python tests
  12. if (DISABLE_GEM_TESTS OR NOT PAL_TRAIT_TEST_PYTEST_SUPPORTED)
  13. return()
  14. endif()
  15. # Register the test so that it runs when you run ctest
  16. # eg, ctest -P <build-config> --test-dir <path-to-your-build-dir-you-used-when-you-ran-cmake>
  17. # eg, ctest -P profile --test-dir build/windows
  18. # eg, ctest -P debug --test-dir build\linux
  19. # Unit tests.
  20. ly_add_pytest(
  21. NAME PyTestMain_main_no_gpu
  22. # the name of the test also has extra optional tags on the end of it, eg
  23. # optional addition of "_main", "_sandbox", "_periodic", "_smoke" puts it in that suite. Unspecified = main
  24. # "_no_gpu" / "_requires_gpu" = it does not require a gpu to run, or it does. Used to filter tests out on headless.
  25. PATH ${CMAKE_CURRENT_LIST_DIR} # this can be a specific .pyfile or a directory to be scanned for files matching "*test*.py"
  26. )