Replace the deprecated `pytest.warns(None)` with the suggested
replacement (from https://github.com/pytest-dev/pytest/issues/9404)
to make the test suite forward compatible with pytest-8. This works
correctly with pytest-6 as well.
* Add test
* To run the workflow
* Fix import
* Format
* Add warning
* Fix indentation
* Test deprecated method
* More test
* Format
* Add import if needed
---------
Co-authored-by: Adrien Vannson <adrien.vannson@gardacp.com>
* Pydantic V2 support
* Support Python 3.8
* Mark as classmethod
* Remove max int validation
* Run poe format
* Merge develop
* Revert dataclasses import
* Fix revert
* feat: pydantic version of google pb
* fix: patch pb Struct to support json, dict rountrip
* fix: pydantic-version google pb, json, dict rntrip
* chore: remove `@generated`, remove gen, code fmt
* chore: test case for pydantic-version google pb
* betterproto: support `Struct` and `Value`
Signed-off-by: William Woodruff <william@trailofbits.com>
* betterproto: handle struct in to_dict as well
Signed-off-by: William Woodruff <william@trailofbits.com>
* tests: add Struct roundtrip tests
Signed-off-by: William Woodruff <william@trailofbits.com>
* specialize from_dict and to_dict on Struct
...rather than special-casing in the Message ABC.
Signed-off-by: William Woodruff <william@trailofbits.com>
* betterproto: `poe format`
Signed-off-by: William Woodruff <william@trailofbits.com>
* Update src/betterproto/__init__.py
Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>
* remove future annotations
Signed-off-by: William Woodruff <william@trailofbits.com>
* replace type[...] with typing.T
Signed-off-by: William Woodruff <william@trailofbits.com>
* quote instead
Signed-off-by: William Woodruff <william@trailofbits.com>
---------
Signed-off-by: William Woodruff <william@trailofbits.com>
Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>
Continuing work from #484 by @kevinaud to fix#419
* Implementing pickle methods
* Implement __copy__, __reduce__, and fix __setstate__
* Moved pickling tests into their own file
* Add test for caching
* Add support for streaming delimited messages
This allows developers to easily dump and load multiple messages
from a stream in a way that is compatible with official
protobuf implementations (such as Java's
`MessageLite#writeDelimitedTo(...)`).
* Add Java compatibility tests for streaming
These tests stream data such as messages to output files, have a
Java binary read them and then write them back using the
`protobuf-java` functions, and then read them back in on the Python
side to check that the returned data is as expected. This checks
that the official Java implementation (and so any other matching
implementations) can properly parse outputs from Betterproto, and
vice-versa, ensuring compatibility in these functions between the
two.
* Replace `xxxxableBuffer` with `SupportsXxxx`
The pytest parameters are evaluated when the tests are loading.
The Deadline.from_timeout is a fixed point in time.
By deferring the evaluation it helps ensure that the deadline is not reached before the test is executed.
This change ensures that deprecation warnings are only raised when
either a deprecated field is explicitly set or a deprecated message is
initialised.
Resolves: #347