• Home
  • Raw
  • Download

Lines Matching +full:python +full:- +full:tests

7 #     https://www.apache.org/licenses/LICENSE-2.0
24 # Constraints file selection (arguments to pip install --constraint).
32 # If true, GN will run each Python test using the coverage command. A separate
34 # this information run: pw presubmit --step gn_python_test_coverage
42 # For example: if lib_a depends on lib_b, lib_a.tests will run after first
43 # running lib_b.tests if pw_build_TEST_TRANSITIVE_PYTHON_DEPS is true.
45 # If pw_build_TEST_TRANSITIVE_PYTHON_DEPS is false, tests for a
47 # lib_b.tests) OR if the pw_python_package is placed in a pw_python_group AND
48 # you build the group.tests target.
50 # This applies to mypy, pylint, and tests.
58 # Python packages provide the following targets as $target_name.$subtarget.
60 "tests",
72 # This allows //foo:foo.tests to be accessed as //foo:tests, for example.
91 # DOCSTAG: [default-mypy-args]
93 "--pretty",
94 "--show-error-codes",
98 "--cache-dir",
103 # See https://github.com/python/mypy/issues/7771
106 # DOCSTAG: [default-mypy-args]
110 [ "--config-file=" + rebase_path(invoker.mypy_ini, root_build_dir) ]
136 # Create a target to run pylint on each of the Python files in this
142 "--jobs=1",
143 "--output-format=$pw_build_PYLINT_OUTPUT_FORMAT",
147 args += [ "--rcfile=" + rebase_path(invoker.pylintrc, root_build_dir) ]
153 args += [ "--disable=unexpected-line-ending-format" ]
176 # Defines a Python package. GN Python packages contain several GN targets:
178 # - $name - Provides the Python files in the build, but does not take any
180 # - $name.lint - Runs static analyis tools on the Python code. This is a group
182 # - $name.lint.mypy - Runs mypy (if enabled).
183 # - $name.lint.pylint - Runs pylint (if enabled).
184 # - $name.tests - Runs all tests for this package.
185 # - $name.install - Installs the package in a venv.
186 # - $name.wheel - Builds a Python wheel for the package.
188 # All Python packages are instantiated with in pw_build_PYTHON_TOOLCHAIN,
189 # regardless of the current toolchain. This prevents Python-specific work, like
197 # sources: Python sources files in the package.
198 # tests: Test files for this Python package.
200 # python_test_deps: Test-only pw_python_package dependencies.
203 # proto_library: A pw_proto_library target to embed in this Python package.
217 # The Python targets are always instantiated in pw_build_PYTHON_TOOLCHAIN. Use
242 # any tests then this variable is not used.
254 "Python packages that import protos with 'proto_library' must " +
262 _python_deps += [ "$_proto.python._deps($_toolchain)" ]
277 # Non-generated packages with sources provided need an __init__.py.
280 "Python packages must have at least one __init__.py file")
312 assert(_supported_static_analysis_tools + [ _tool ] - [ _tool ] !=
329 # Argument: tests (list)
331 if (defined(invoker.tests)) {
333 foreach(source, rebase_path(invoker.tests, _source_root)) {
337 _test_sources += invoker.tests
362 "python_test_deps was provided, but there are no tests in " +
379 # Get Python package metadata and write to disk as JSON.
391 tests = rebase_path(_test_sources, root_build_dir)
408 # Create a target group for the Python package metadata only. This is a
434 # Declare the main Python package group. This represents the Python files,
446 if (defined(invoker.tests)) {
447 sources += invoker.tests
494 "--label",
496 "--generated-root",
498 "--setup-json",
505 ".python($pw_protobuf_compiler_TOOLCHAIN)"
509 "--proto-library",
516 args += [ "--module-as-package" ]
541 # Builds a Python wheel for this package. Records the output directory
554 "--package-dir",
556 "--out-dir",
562 args += [ "--generate-hashes" ]
573 # Stub for non-package targets.
579 # executions, non-generated packages are only reinstalled when their
581 # re-run whenever any source files change.
645 foreach(_unused_tool, _supported_static_analysis_tools - _static_analysis) {
662 # Python actions instantiated with the default toolchain. This ensures there
663 # is only a single copy of each Python action in the build.
665 # The $target_name.tests group is created separately below.
670 foreach(subtarget, pw_python_package_subtargets - [ "tests" ]) {
677 # Everything Python-related is only instantiated in the default toolchain.
678 # Silence not-needed warnings except for in the default toolchain.
693 _test_target = "$target_name.tests." + string_replace(_name, "/", "_")
703 "--branch",
706 "--source=.",
712 # Set the coverage file to a location in out/python/gen/
726 # Make sure the python test deps are added to the PYTHONPATH.
731 # folder containing the package sources to allow local Python imports.
740 deps += [ string_replace(dep, "(", ".tests(") ]
745 # Create a public version of each test target, so tests can be executed as
746 # //path/to:package.tests.foo.py.
755 group("$target_name.tests") {
763 # Declares a group of Python packages or other Python groups. pw_python_groups
765 # "$group_name.lint" and "$group_name.tests"), but these apply to all packages
783 # Create a target group for the Python package metadata only.
809 # Declares Python scripts or tests that are not part of a Python package.
827 "tests",
863 # Represents a list of Python requirements, as in a requirements.txt.
867 # requirements: A list of requirements.txt-style requirements.
893 # TODO: b/232800695 - Remove reliance on this subtarget existing.
898 foreach(subtarget, pw_python_package_subtargets - [ "install" ]) {
903 # Create a target group for the Python package metadata only.