| # Copyright 2026 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/python/python_host_test.gni") | |
| import("//build/python/python_library.gni") | |
| # Tests python_library() with `imports`, which stages sources like Bazel's | |
| # py_library() adds them to the import path. | |
| # Imported as `vendored` and `vendored_module`, not by the target name. | |
| python_library("vendored_lib") { | |
| testonly = true | |
| sources = [ | |
| "src/vendored/__init__.py", | |
| "src/vendored/helper.py", | |
| "src/vendored_module.py", | |
| ] | |
| imports = [ "src" ] | |
| data_sources = [ "data.txt" ] | |
| data_package_name = "data" | |
| } | |
| # Imported by the name of this directory, `imports`. | |
| python_library("imports_parent") { | |
| testonly = true | |
| sources = [ "__init__.py" ] | |
| imports = [ ".." ] | |
| } | |
| python_host_test("imports_test") { | |
| main_source = "imports_test.py" | |
| libraries = [ | |
| ":imports_parent", | |
| ":vendored_lib", | |
| ] | |
| } | |
| group("tests") { | |
| testonly = true | |
| deps = [ ":imports_test" ] | |
| } |