abseil / abseil-py

Abseil Common Libraries (Python)
Apache License 2.0
2.27k stars 246 forks source link

`absltest`: do not fail tests on Python 3.12+ when no tests ran and: #253

Closed copybara-service[bot] closed 11 months ago

copybara-service[bot] commented 11 months ago

absltest: do not fail tests on Python 3.12+ when no tests ran and:

Context: Python 3.12 unittest will now fail when no tests ran after the change from https://github.com/python/cpython/pull/102051. Since absltest is built on top of unittest, it will follow this behavior change in Python 3.12.

However, when test filtering is used in absltest, often used via bazel test --test_filter=<my_filter>, the current user expectation is the bazel test command should NOT fail is at least one test ran. Since the test runner here has no visibility of the overall bazel invocation, we'll make the test not fail when test filtering is used via bazel's environment variable. This is the existing behavior before Python 3.12.

Also test absl-py on Python 3.12.