diff options
author | Richard Levasseur <rlevasseur@google.com> | 2019-04-11 10:49:00 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2019-04-11 10:49:35 -0700 |
commit | 31ee376969da6f95b227f80d4f84e4bbb1aa369c (patch) | |
tree | 9467a5891c7d76afeaf05f81c916c4490869204d /absl/flags/tests | |
parent | dcdec971f1541a0453eba8885c273cef217f2ecb (diff) | |
download | absl-py-31ee376969da6f95b227f80d4f84e4bbb1aa369c.tar.gz |
Make absl tests pass under new Bazel Python version transition logic.
This makes the absl tests pass when
--incompatible_allow_python_version_transitions=true is set.
Many tests use subprocesses to verify behavior and were relying on
how the subprocess's Python version would match the test's Python
version. Since this stickiness is going away, to keep the test and
subprocess using the same Python version, the binaries have to be
defined twice, one for each Python version, and a select()
used with the test to select the matchiing binary.
NOTE: Under bazel and Python 3, --python_version=PY3 flag must be
specified so that bazel knows how to properly resolve selects.
PiperOrigin-RevId: 243099319
Diffstat (limited to 'absl/flags/tests')
-rw-r--r-- | absl/flags/tests/argparse_flags_test.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/absl/flags/tests/argparse_flags_test.py b/absl/flags/tests/argparse_flags_test.py index 244f977..51ed7fa 100644 --- a/absl/flags/tests/argparse_flags_test.py +++ b/absl/flags/tests/argparse_flags_test.py @@ -419,11 +419,11 @@ class ArgparseWithAppRunTest(parameterized.TestCase): env = os.environ.copy() env['MAIN_FUNC'] = main_func_name env['FLAGS_PARSER_FUNC'] = flags_parser_func_name - helper = 'absl/flags/tests/argparse_flags_test_helper' + helper = _bazelize_command.get_executable_path( + 'absl/flags/tests/argparse_flags_test_helper', add_version_suffix=False) try: stdout = subprocess.check_output( - [_bazelize_command.get_executable_path(helper)] + args, env=env, - universal_newlines=True) + [helper] + args, env=env, universal_newlines=True) except subprocess.CalledProcessError as e: error_info = ('ERROR: argparse_helper failed\n' 'Command: {}\n' |