google / subpar

Subpar is a utility for creating self-contained python executables. It is designed to work well with Bazel.
Apache License 2.0
567 stars 69 forks source link

Tests may fail when run via `bazel test` #105

Closed brandjon closed 5 years ago

brandjon commented 5 years ago

After the fix to tests for #98, tests may fail when run directly via bazel test as opposed to through the runner script run_tests.sh. I see two modes of failure:

  1. When --incompatible_use_python_toolchains is disabled, //tests:version_test may fail if /usr/bin/env python is a Python 2 interpreter, due to bazelbuild/bazel#4815.

  2. When --incompatible_use_python_toolchains is enabled, the default toolchain's py[2|3]wrapper.sh script is added to runfiles, causing brittle assertions in many tests to fail. This doesn't appear under run_tests.sh because it has its own custom toolchain that adds no runfiles.

This isn't an immediate problem because CI still passes, but it is annoying for the developer workflow. For 1), I'd just wait for the toolchain flag flip. For 2), the test assertions should be made more robust. In the meantime, use run_tests.sh instead of bazel test //....

brandjon commented 5 years ago

Turns out it is a problem for Bazel downstream CI, just not subpar's own CI.