| # Copyright 2024 The Bazel Authors. All rights reserved. |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| load(":interpreter_tests.bzl", "PYTHON_VERSIONS_TO_TEST", "py_reconfig_interpreter_tests") |
| |
| # For this test the interpreter is sourced from the current configuration. That |
| # means both the interpreter and the test itself are expected to run under the |
| # same Python version. |
| py_reconfig_interpreter_tests( |
| name = "interpreter_version_test", |
| srcs = ["interpreter_test.py"], |
| data = [ |
| "//python/bin:python", |
| ], |
| env = { |
| "PYTHON_BIN": "$(rootpath //python/bin:python)", |
| }, |
| main = "interpreter_test.py", |
| python_versions = PYTHON_VERSIONS_TO_TEST, |
| ) |
| |
| # For this test the interpreter is sourced from a binary pinned at a specific |
| # Python version. That means the interpreter and the test itself can run |
| # different Python versions. |
| py_reconfig_interpreter_tests( |
| name = "python_src_test", |
| srcs = ["interpreter_test.py"], |
| data = [ |
| "//python/bin:python", |
| ], |
| env = { |
| # Since we're grabbing the interpreter from a binary with a fixed |
| # version, we expect to always see that version. It doesn't matter what |
| # Python version the test itself is running with. |
| "EXPECTED_INTERPRETER_VERSION": "3.11", |
| "PYTHON_BIN": "$(rootpath //python/bin:python)", |
| }, |
| main = "interpreter_test.py", |
| python_src = "//tools/publish:twine", |
| python_versions = PYTHON_VERSIONS_TO_TEST, |
| ) |