aboutsummaryrefslogtreecommitdiff
path: root/absl
AgeCommit message (Collapse)Author
2022-10-03Fix typo in documentationAbseil Team
PiperOrigin-RevId: 478521309 Change-Id: Ica34fdda749b928fcf73e030bc3fa4e1585a753c
2022-09-20Add a flags.set_default function.Abseil Team
PiperOrigin-RevId: 475611494 Change-Id: I9facdfcaece0b3c0bd2b0b38364ecd41cb06d79c
2022-09-13Support FlagHolders in flag module-level functions.Abseil Team
PiperOrigin-RevId: 474195462 Change-Id: I2b57d8ea6b8eb66d1f777f026fb19e5401983789
2022-09-09Remove Python 2 compat code.Abseil Team
PiperOrigin-RevId: 473306343 Change-Id: I4c166f7fa34ce2f1b0bcacafbf790d4f932886d1
2022-08-29Output elapsed time duration values with millisecond precisionMatt McDonald
This change tweaks the formatting used for outputting elapsed time duration values for testsuite and testcase nodes in the XML output file produced by `TextAndXMLTestRunner` to allow for visibility down to milliseconds of precision. This also aligns with C++ https://github.com/google/googletest PiperOrigin-RevId: 470750030 Change-Id: If940033e0e44adf95ff3bf43125c185f438b8d8e
2022-08-25Fix typoHaoyuan Zhong
PiperOrigin-RevId: 470123526 Change-Id: I6b5f20518c05e29a413cab9a331a69c769c8f355
2022-08-24Expose the public APIs as the `__all__` attribute in `absl/flags/__init__.py`.Yilei Yang
This also makes sphinx autodoc generate docs for exposed APIs. Also make `absl.flags`'s docstring compatible with reST. PiperOrigin-RevId: 469768218 Change-Id: I6fd3807de05d6803a0aa73b3872555e53d504e8d
2022-08-19Updates the absl `assertRaisesWithPredicateMatch` and ↵Matt Doyle
`assertRaisesWithLiteralMatch` method to also store the caught exception object in the returned context manager's `exception` attribute. PiperOrigin-RevId: 468744160 Change-Id: Iebc6e20d2084d1d078f5dd989d705209a94e1e45
2022-08-19Update some of the docstrings to be compatible with `reST`, in preparation ↵Yilei Yang
to add generated docs by Sphinx/readthedocs. This is just an initial pass, far from great documentations. PiperOrigin-RevId: 468721475 Change-Id: I5b4f9b2127add933d7eb56414b4fa1751cdacb3d
2022-07-25Make it possible to pass keyword args to exception().Abseil Team
PiperOrigin-RevId: 463213585 Change-Id: Ibeea24bb64c116ab5a998032910a033f1c0c08a4
2022-07-18Work around a Pytype issue in `DEFINE_multi_enum_class`'s return value where ↵Yilei Yang
an iterable of concrete enum values are used as the default. PiperOrigin-RevId: 461656002 Change-Id: Ic6d0699ad4f507d9f6ae24ab4aad0d7b8b19bd63
2022-07-14Make `TempFileCleanup.SUCCESS` work with Python 3.11 after ↵Yilei Yang
https://github.com/python/cpython/pull/28180. After the change, the errors from the test case were no longer buffered in `_Outcome`. Instead, we need to take a note of errors on the `TestResult` before, then compare errors after. PiperOrigin-RevId: 461070558 Change-Id: I7d9f769cd46143a886bc5edeb224804acd8dbaf9
2022-06-13Use type annotations instead of type comments for this method.Abseil Team
PiperOrigin-RevId: 454734291 Change-Id: I043f77b129a411a9f517b37800df3ea729cb7a59
2022-06-09Re-work how side effects are avoided when getting the non flags `argv` when ↵Yilei Yang
`absltest.main()` is called inside `app.run()`. We just want to remove the defined flags from the original `sys.argv` without affect anything. At that point, flags are already parsed by `app.run()`. The original code also has an issue with validators and multi- flags. Calling `FLAGS(sys.argv)` will duplicate the flag values then run flag validators, which can fail before the flag values are restored. PiperOrigin-RevId: 454052335 Change-Id: I24a3af6bb3c68dbc17ebc54a2c99e08b1a10d60a
2022-06-08Remove the unnecessary Python 2 related future imports.Yilei Yang
PiperOrigin-RevId: 453697925 Change-Id: I24a9fbbe2a690d7101b7190f4b4976d16bd0942f
2022-05-23Make FlagHolder unconditionally generic.John Aslanides
Now that we've dropped Python 2 support, we can drop the conditional import of `typing`. PiperOrigin-RevId: 450471818 Change-Id: I6c4efc7b6943b9794b2a3cf1eba90d330d6b73fd
2022-05-06Remove the py2/py3 compatibility module _collections_abc.Yilei Yang
PiperOrigin-RevId: 447005334 Change-Id: Iea86a969093640a18663d3d135648329c45e9954
2022-05-05Remove the use of six in absl.flags.Yilei Yang
PiperOrigin-RevId: 446842401 Change-Id: Ic66c537d810dda858318a95e5f7b2242f58f7c75
2022-04-11Remove unused comments related to Python 2 compatibility.Yilei Yang
PiperOrigin-RevId: 440945020 Change-Id: I78d78173ca4a122208950176104e9ae722616e42
2022-03-22Remove the use of third party `mock` package and future imports in these tests.Yilei Yang
Also remove the mock package in bazel WORKSPACE file. PiperOrigin-RevId: 436585035 Change-Id: I7f8eafac5f7b10dc8f580db20c7ae60711dfdf12
2022-03-21Remove comments, license is declared in the LICENSE file.Yilei Yang
PiperOrigin-RevId: 436293697 Change-Id: I4ebf90127a781162636fa728c8899d76937dbca6
2022-03-21Remove the use of six in absl.testing.Yilei Yang
PiperOrigin-RevId: 436216380 Change-Id: I1058b3893eaf6e18c2872c2cf2533c3109bb972f
2022-03-16Fix some lint errors.Yilei Yang
The test helper change is for a test that will be released in a future version. PiperOrigin-RevId: 435099266 Change-Id: I870a7a6386f5ecca4e349b1211b92c723dfd8c54
2022-03-04Improve the type annotations for assertRaisesWith{Literal,Predicate}Match.Rebecca Chen
PiperOrigin-RevId: 432505574 Change-Id: I581809fc35b40fd477a111154065a281c53eee00
2022-02-22Enumerate possible values in multi_enum flag help.Abseil Team
PiperOrigin-RevId: 430280700 Change-Id: I62ca45c7b794989f9e8ee66094fb73c5ac7a6840
2022-02-08Prevent the truthiness of absl.flags Flag instances from being tested in a ↵Gregory P. Smith
bool context (not useful) to avoid situations where someone really wanted to refer to `their_flag.value` instead. This prevents logic bugs. There were ~10 problems found by this and cleaned up in our internal codebase. PiperOrigin-RevId: 427295923 Change-Id: Ifc9e086133986cc14d052a06889a93c1ab0ff688
2022-02-07Cleanup the use of `six` and future imports in `absl.logging`.Yilei Yang
PiperOrigin-RevId: 426998346 Change-Id: I6b7ad5496864aee2bfff9b7cdff4ed70fd790a34
2022-02-04Merge https://github.com/abseil/abseil-py/pull/186.Yilei Yang
PiperOrigin-RevId: 426506531 Change-Id: I7a291ac06fc88c9970d58241538a7bdc3ffd7fa4
2022-01-24Remove PY2-ism in absl's own unit tests.Yilei Yang
PiperOrigin-RevId: 423878454 Change-Id: Iadc82651ecd39954cfd2af6b4bae2a98388fd75b
2022-01-21Merge _parameterized_async.py into parameterized.py now that we have dropped ↵Yilei Yang
Python 2 support. PiperOrigin-RevId: 423364637 Change-Id: I700992249af0b0a17cddedf45f5969905bc5a954
2022-01-20Merge changes from github.Yilei Yang
PiperOrigin-RevId: 423095241 Change-Id: Ie78fb886746b11320e777587bf50c938d9054e37
2021-11-16Simplify this code to use a `with` block.Yilei Yang
PiperOrigin-RevId: 410287536 Change-Id: I50b3999e8da21aefa65314a121fddf8e832d57b0
2021-11-05Set the stacklevel=2 in those UserWarnings, so that they are emitted where ↵Yilei Yang
these functions are not, not in _validators.py. PiperOrigin-RevId: 407853170 Change-Id: Iff13f2a1ca391109f9a7e85f2a91abbe3cba3c53
2021-10-28Move the CHANGELOG.md file to top level directory.Yilei Yang
PiperOrigin-RevId: 406169399 Change-Id: Ib52043ca4b5902b3fc3915a97568626fbfc755b6
2021-10-26Remove unused _absl_test_platform_deps.Yilei Yang
PiperOrigin-RevId: 405738888 Change-Id: I8d74a26f6ef33d8e0b3fabb8a5f1227e65e81ef9
2021-10-26Remove the unittest3_backport code now that we have dropped Python 2 support.Yilei Yang
Also removed a few `six.PY2` protected methods in absltest since the linter recognizes the super class and reports the use of deprecated methods errors. PiperOrigin-RevId: 405723651 Change-Id: I60835dd7b30695c7c35613080621a0cbdebe890f
2021-10-25Drop the support of Python 2.7, 3.4, and 3.5. All versions have reached ↵Yilei Yang
end-of-life for more than a year now. PiperOrigin-RevId: 405511743 Change-Id: Id0f78693a6de9474576c3cfa879caf2cc177d8f6
2021-10-19Preparing the release of absl-py 0.15.0.Yilei Yang
PiperOrigin-RevId: 404282150 Change-Id: I3600a465b46e634e1f20fb7d33e49bc4280f7a29
2021-10-13Add a python_version_test.py, useful to ensure the Python used by bazel is ↵Yilei Yang
expected. Example: `bazel test absl:tests/python_version_test --test_arg=--expected_version=3.10.0` PiperOrigin-RevId: 402933630 Change-Id: Ib62d9c21ec93cab5bd657bcd4c88ed2881583850
2021-10-07#128: support matching substring and glob patterns using bazel's ↵Yilei Yang
`--test_filter=` flag (Python 3.7+ only). Previously, the `--test_filter=` arguments are passed to Python's unittest as positional arguments. This only matches by class or method's full names. After this, `--test_filter=` has the same meaning as unittest's `-k` flag: https://docs.python.org/3/library/unittest.html#cmdoption-unittest-k One notable behavior difference: previously if the filter doesn't match any tests, the test would fail; now it doesn't fail. This also makes filtering `absltest.parameterized` tests significantly more user friendly. This change is only for Python 3.7+. PiperOrigin-RevId: 401582298 Change-Id: I074e9283706fe9c88a8dbb392084fb6548cebc6f
2021-10-07When running a absltest helper binary in absltest's own tests, also inherit ↵Yilei Yang
the `PATH` variable. The `PATH` variable is needed to correctly run the Python version determined by bazel, since the `py_binary` uses `#!/usr/bin/env python` to run it. PiperOrigin-RevId: 401540949 Change-Id: Ic2aefcb5d8168117ade840c91ea1051f0a28a809
2021-10-04Correctly make these tests to cover the actual usage from `tensorflow`.Yilei Yang
`tensorflow` is calling `absltest.main(argv=argv)` **inside** the main function called by `app.run`: https://github.com/tensorflow/tensorflow/blob/b743f04b1f1b0600ac5bb1c0b8bfc7e33896255a/tensorflow/python/platform/googletest.py#L62-L64 Directly calling `absltest.main(argv=sys.argv)` means to use `sys.argv` for both absl flags parsing AND unittest.main(argv=), which doesn't make much sense. PiperOrigin-RevId: 400862986 Change-Id: I1af4978d62b9a727bc79e3715b881c78b2e380b9
2021-10-04Correctly create `absltest_filter_test`'s `as_commandline_args_no_argv` cases.Yilei Yang
PiperOrigin-RevId: 400827557 Change-Id: I09c1a1e183abcf213dacc89169ae9efdbce5945f
2021-09-30Preparing the release of absl-py 0.14.1.Yilei Yang
PiperOrigin-RevId: 400032919 Change-Id: I3dc54cac0c98f0d3a64f8471a35f2bfea5cf24bd
2021-09-29Remove these exports_files, those LICENSE files no longer exist in their ↵Yilei Yang
directory after #159 (#160). PiperOrigin-RevId: 399810236 Change-Id: Ia78c6e27fbcf65c2c9e0de0d1c171c7a172f450a
2021-09-21Preparing the release of absl-py 0.14.0.Yilei Yang
PiperOrigin-RevId: 398077931 Change-Id: I8e6633cd3fea910cc31ac2bbe6e4c97a08b25b9b
2021-09-21Fix typo in the docstring.Yilei Yang
PiperOrigin-RevId: 398009906 Change-Id: Idf2432e17a4621a4599371e4e20451f9596530ed
2021-09-20Fix #173: Correctly set up test filtering and fail fast flags for users who ↵Yilei Yang
explicitly pass `argv=` to the `main` function. This resolves the issue that users of `tf.test.main` can't use bazel to filter tests, as described in https://github.com/abseil/abseil-py/issues/128#issuecomment-921993484 PiperOrigin-RevId: 397883687 Change-Id: Ica703a7c3c67ccca8973340d5812e385e29f1025
2021-07-26absl: Expose the `.present` property from `Flag` on `FlagHolder`Abseil Team
The `FlagHolder` object is returned from `flags.DEFINE_*()` to allow type-safe and fully-declared access via `myflag.value`, instead of requiring users to write `FLAGS.myflag`. Additionally, this proxies the `.default` property from the `Flag` object underlying the `FlagHolder`, so `FLAGS['myflag'].default` can instead be written as simply `myflag.default`. However, the `.present` property is not easily available today without writing `FLAGS['myflag'].present` or `FLAGS[myflag.name].present`, despite being relatively commonly used. Since it intuitively makes sense for this to be available, let's proxy it through `FlagHolder` to the underlying `Flag` object. PiperOrigin-RevId: 386901861 Change-Id: I29e3173668080957b796c8634527382b792aa4ec
2021-07-19Fix #171: add an ignored `default=` argument to our custom actions.Yilei Yang
This is a required argument for custom argparse.Action classes, and is used when the `ArgumentParse` is created with a `argument_default=`. PiperOrigin-RevId: 385601086 Change-Id: I01ef4870aa4f0e92f7e8f9be0125c9a0dba16c6f