| # Copyright 2020 The Fuchsia Authors. All rights reserved. | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| import("//build/bazel/bazel_test_suite.gni") | |
| import("//build/python/python_binary.gni") | |
| import("//build/python/python_host_test.gni") | |
| import("//build/python/python_library.gni") | |
| import("//build/testing/host_test_data.gni") | |
| assert(is_host, "python only supported in host toolchains") | |
| host_test_data("black") { | |
| sources = [ "//prebuilt/third_party/black/${host_platform}/black" ] | |
| } | |
| host_test_data("interpreter") { | |
| sources = [ | |
| "//prebuilt/third_party/python3/${host_platform}/lib", | |
| python_exe_src, | |
| ] | |
| } | |
| host_test_data("pip") { | |
| sources = [ | |
| "//prebuilt/third_party/python3/${host_platform}/lib", | |
| pip_exe_src, | |
| ] | |
| } | |
| bazel_test_suite("bazel_tests") { | |
| tests = [ "//build/python/..." ] | |
| } | |
| python_library("coverage_site") { | |
| enable_mypy = true | |
| library_deps = [ "//third_party/pylibs/coverage" ] | |
| source_root = "coverage_site" | |
| sources = [ | |
| "__init__.py", | |
| "_fuchsia_pycov.py", | |
| "sitecustomize.py", | |
| ] | |
| } | |
| python_host_test("coverage_site_test") { | |
| main_source = "coverage_site/coverage_site_test.py" | |
| sources = [ "coverage_site/coverage_site_test.py" ] | |
| libraries = [ | |
| ":coverage_site", | |
| "//third_party/pylibs/coverage", | |
| ] | |
| } | |
| # Python test scripts in subdirectories that have been migrated to Bazel-only | |
| # host_py_test() targets. Listing them here makes them subject to GN mypy | |
| # type checking as required by //build/shac.star. | |
| python_library("type_checked_scripts") { | |
| testonly = true | |
| visibility = [ ":*" ] | |
| sources = [ | |
| "tests/assembly/assembly_module_test.py", | |
| "tests/depfile/depfile_test.py", | |
| "tests/host_test/py_host_test_with_lib.py", | |
| "tests/serialization/serialization_test.py", | |
| ] | |
| library_deps = [ | |
| "//build/python/modules/assembly", | |
| "//build/python/modules/depfile", | |
| "//build/python/modules/serialization", | |
| "//build/python/tests/fast_copy_mock", | |
| "//build/python/tests/lib", | |
| ] | |
| } | |
| group("host_tests") { | |
| testonly = true | |
| deps = [ | |
| ":bazel_tests", | |
| ":coverage_site_test", | |
| ":type_checked_scripts", | |
| "tests/bin", | |
| "tests/imports:tests", | |
| "tests/lib", | |
| ] | |
| } | |
| python_binary("compress_lacewing_inputs") { | |
| main_source = "compress_lacewing_inputs.py" | |
| } | |
| python_binary("python_hermetic_concatenate") { | |
| enable_mypy = true | |
| main_source = "python_hermetic_concatenate.py" | |
| } | |
| python_binary("package_python_wheel") { | |
| enable_mypy = true | |
| main_source = "package_python_wheel.py" | |
| sources = [ "package_python_binary.py" ] | |
| deps = [ "//build/python/modules/depfile" ] | |
| } | |
| group("tests") { | |
| testonly = true | |
| deps = [ | |
| ":host_tests", | |
| "tests/bin", | |
| "tests/lib", | |
| ] | |
| } |