Releases: abseil/abseil-py
Releases · abseil/abseil-py
v2.3.1
v2.3.0
v2.2.2
Added
- (testing) Added a new method
absltest.TestCase.assertMappingEqualthat tests equality of Mapping objects not requiring them to be dicts. Similar toassertSequenceEqualbut for mappings. - (testing) Added a new method
absltest.assertDictContainsSubsetthat checks that a dictionary contains a subset of keys and values. Similar to a removed methodunittest.assertDictContainsSubset(existed until Python 3.11). - Added type annotations that are compliant with MyPy.
Changed
- Removed support for Python 3.7.
Fixed
- (testing) Fixed an issue where the test reporter crashes with exceptions with no string representation, starting with Python 3.11.
(The change log also includes changes in 2.2.0 and 2.2.1.)
v2.1.0
Added
- (flags) Added
absl.flags.override_valuefunction to provideFlagHolderwith a construct to modify values. The new interface parallelsabsl.flags.FlagValues.__setattr__but checks that the provided value conforms to the flag's expected type. - (testing) Added a new method
absltest.TestCase.assertDataclassEqualthat tests equality ofdataclass.dataclassobjects with better error messages when the assert fails.
Changed
- (flags)
absl.flags.argparse_flags.ArgumentParsernow correctly inherits an empty instance ofFlagValuesto ensure that absl flags, such as--flagfile,--undefokare supported. - (testing) Do not exit 5 if tests were skipped on Python 3.12. This follows the CPython change in python/cpython#113856.
Fixed
- (flags) The flag
foono longer retains the valuebarafterFLAGS.foo = barfails due to a validation error. - (testing) Fixed an issue caused by this Python 3.12.1 change where the test reporter crashes when all tests are skipped.
v2.0.0
New
- Support Python 3.12.
Changed
absl-pyno longer supports Python 3.6. It has reached end-of-life for more
than a year now.- (logging)
logging.exceptioncan now takeexc_infoas argument, with
default valueTrue. Prior to this change settingexc_infowould raise
KeyError, this change fixes this behaviour. - (testing) For Python 3.11+, the calls to
absltest.TestCase.enter_context
are forwarded tounittest.TestCase.enterContext(when called via instance)
orunittest.TestCase.enterClassContext(when called via class) now. As a
result, on Python 3.11+, the private_cls_exit_stackattribute is not
defined onabsltest.TestCaseand_exit_stackattribute is not defined on
its instances. - (testing)
absltest.TestCase.assertSameStructure()now uses the test case's
equality functions (registered withTestCase.addTypeEqualityFunc()) for
comparing leaves of the structure. - (testing)
abslTest.TestCase.fail()now names its arguments
(self, msg=None, user_msg=None), and not(self, msg=None, prefix=None),
better reflecting the behavior and usage of the two message arguments. DEFINE_enum,DEFINE_multi_enum, andEnumParsernow raise errors when
enum_valuesis provided as a single string value. Additionally,
EnumParser.enum_valuesis now stored as a list copy of the provided
enum_valuesparameter.- (testing) Updated
paramaterized.CoopTestCase()to use Python 3 metaclass
idioms. Most uses of this function continued working during the Python 3
migration still worked because a Python 2 compatibility__metaclass__
variables also existed. Now pure Python 3 base classes without backwards
compatibility will work as intended. - (testing)
absltest.TestCase.assertSequenceStartsWithnow explicitly fail
when passed aMappingorSetobject as thewholeargument.
v1.4.0
New
- (testing) Added
@flagsaver.as_parsed: this allows saving/restoring flags
using string values as if parsed from the command line and will also reflect
other flag states after command line parsing, e.g..presentis set.
Changed
- (logging) If no log dir is specified
logging.find_log_dir()now falls back
totempfile.gettempdir()instead of/tmp/.
Fixed
- (flags) Additional kwargs (e.g.
short_name=) toDEFINE_multi_enum_class
are now correctly passed to the underlyingFlagobject.
v1.3.0
Added
- (flags) Added a new
absl.flags.set_defaultfunction that updates the flag
default for a providedFlagHolder. This parallels the
absl.flags.FlagValues.set_defaultinterface which takes a flag name. - (flags) The following functions now also accept
FlagHolderinstance(s) in
addition to flag name(s) as their first positional argument:flags.register_validatorflags.validatorflags.register_multi_flags_validatorflags.multi_flags_validatorflags.mark_flag_as_requiredflags.mark_flags_as_requiredflags.mark_flags_as_mutual_exclusiveflags.mark_bool_flags_as_mutual_exclusiveflags.declare_key_flag
Changed
- (testing) Assertions
assertRaisesWithPredicateMatchand
assertRaisesWithLiteralMatchnow capture the raisedExceptionfor
further analysis when used as a context manager. - (testing) TextAndXMLTestRunner now produces time duration values with
millisecond precision in XML test result output. - (flags) Keyword access to
flag_namearguments in the following functions
is deprecated. This parameter will be renamed in a future 2.0.0 release.flags.register_validatorflags.validatorflags.register_multi_flags_validatorflags.multi_flags_validatorflags.mark_flag_as_requiredflags.mark_flags_as_requiredflags.mark_flags_as_mutual_exclusiveflags.mark_bool_flags_as_mutual_exclusiveflags.declare_key_flag