diff options
author | Yilei Yang <yileiyang@google.com> | 2021-11-17 09:24:51 -0800 |
---|---|---|
committer | Yilei Yang <yileiyang@google.com> | 2021-11-17 09:24:51 -0800 |
commit | a9bb1279de28446a06631c725375d26f32a8312a (patch) | |
tree | ab1ae172557b4ae3931ca634826ef5f7131b2692 | |
parent | 0f86230d77cd90ea1236f0cbee4df9a9b290ef66 (diff) | |
parent | 4b3aba62b7d02d92ac9f513301503a53150537ae (diff) | |
download | absl-py-a9bb1279de28446a06631c725375d26f32a8312a.tar.gz |
Merge commit for internal changes.
-rw-r--r-- | CONTRIBUTING.md | 6 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | absl/testing/absltest.py | 14 |
3 files changed, 9 insertions, 13 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 52b2e09..5134aff 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -51,11 +51,11 @@ will be expected to conform to the Python style outlined * Maintain **clean commit history** and use **meaningful commit messages**. PRs with messy commit history are difficult to review and won't be merged. - Use `rebase -i upstream/master` to curate your commit history and/or to - bring in latest changes from master (but avoid rebasing in the middle of a + Use `rebase -i upstream/main` to curate your commit history and/or to + bring in latest changes from main (but avoid rebasing in the middle of a code review). -* Keep your PR up to date with upstream/master (if there are merge conflicts, +* Keep your PR up to date with upstream/main (if there are merge conflicts, we can't really merge your change). * **All tests need to be passing** before your change can be merged. We @@ -41,7 +41,7 @@ bazel test absl/... ### Example Code Please refer to -[smoke_tests/sample_app.py](https://github.com/abseil/abseil-py/blob/master/smoke_tests/sample_app.py) +[smoke_tests/sample_app.py](https://github.com/abseil/abseil-py/blob/main/smoke_tests/sample_app.py) as an example to get started. ## Documentation diff --git a/absl/testing/absltest.py b/absl/testing/absltest.py index 4779663..ffad3da 100644 --- a/absl/testing/absltest.py +++ b/absl/testing/absltest.py @@ -2394,16 +2394,12 @@ def _setup_sharding(custom_loader=None): # to query whether a test binary implements the test sharding protocol. if 'TEST_SHARD_STATUS_FILE' in os.environ: try: - f = None - try: - f = open(os.environ['TEST_SHARD_STATUS_FILE'], 'w') + with open(os.environ['TEST_SHARD_STATUS_FILE'], 'w') as f: f.write('') - except IOError: - sys.stderr.write('Error opening TEST_SHARD_STATUS_FILE (%s). Exiting.' - % os.environ['TEST_SHARD_STATUS_FILE']) - sys.exit(1) - finally: - if f is not None: f.close() + except IOError: + sys.stderr.write('Error opening TEST_SHARD_STATUS_FILE (%s). Exiting.' + % os.environ['TEST_SHARD_STATUS_FILE']) + sys.exit(1) base_loader = custom_loader or TestLoader() if 'TEST_TOTAL_SHARDS' not in os.environ: |