-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/async message consumer #714
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Use the `__all__` to mark the `Pact` and `Verifier` imports as public re-exports, thereby removing the need to silence F401. Signed-off-by: JP-Ellis <josh@jpellis.me>
Main changes include: - Addition of a `PactAsyncMessageIterator` (and related functions) - Addition of `*_generate_contents` functions which are analogous to the `*_get_contents` functions, but replace any matchers/generators with the relevant substitution in order to generate a 'real' payload. - Addition of `with_metadata` to add metadat to an interaction - Addition of `with_generators` to add generators to an interaction - Deprecation of the `MessagePactHandle` and `MessageHandle` Signed-off-by: JP-Ellis <josh@jpellis.me>
Define some type aliases for some enums. As a result of this, functions which take a subclass of an `Enum` can be, fairly straightforwardly, adapted to allow strings of the enum values. Co-authored-by: valkolovos <val.kolovos@guildeducation.com> Co-authored-by: JP-Ellis <josh@jpellis.me> Signed-off-by: JP-Ellis <josh@jpellis.me>
Signed-off-by: JP-Ellis <josh@jpellis.me>
Co-authored-by: valkolovos <val.kolovos@guildeducation.com> Co-authored-by: JP-Ellis <josh@jpellis.me> Signed-off-by: JP-Ellis <josh@jpellis.me>
The `Generator` (and other closely related types) are returned by the `MessageContents` type. These will generally not be used, but may prove to be useful in a few select circumstances. Co-authored-by: valkolovos <val.kolovos@guildeducation.com> Co-authored-by: JP-Ellis <josh@jpellis.me> Signed-off-by: JP-Ellis <josh@jpellis.me>
Along with associated types Co-authored-by: valkolovos <val.kolovos@guildeducation.com> Co-authored-by: JP-Ellis <josh@jpellis.me> Signed-off-by: JP-Ellis <josh@jpellis.me>
The `InteractionHandle` is the intended way to define interactions, with `Message` and `MessageHandle` being replaced by the former. Signed-off-by: JP-Ellis <josh@jpellis.me>
Co-authored-by: valkolovos <val.kolovos@guildeducation.com> Co-authored-by: JP-Ellis <josh@jpellis.me> Signed-off-by: JP-Ellis <josh@jpellis.me>
Co-authored-by: valkolovos <val.kolovos@guildeducation.com> Co-authored-by: JP-Ellis <josh@jpellis.me> Signed-off-by: JP-Ellis <josh@jpellis.me>
Co-authored-by: valkolovos <val.kolovos@guildeducation.com> Co-authored-by: JP-Ellis <josh@jpellis.me> Signed-off-by: JP-Ellis <josh@jpellis.me>
Co-authored-by: valkolovos <val.kolovos@guildeducation.com> Co-authored-by: JP-Ellis <josh@jpellis.me> Signed-off-by: JP-Ellis <josh@jpellis.me>
Co-authored-by: valkolovos <val.kolovos@guildeducation.com> Co-authored-by: JP-Ellis <josh@jpellis.me> Signed-off-by: JP-Ellis <josh@jpellis.me>
Signed-off-by: JP-Ellis <josh@jpellis.me>
Signed-off-by: JP-Ellis <josh@jpellis.me>
A couple of minor changes to the docs clarifying the role of `Interaction Part`, especially in the context of asynchronous messages. Signed-off-by: JP-Ellis <josh@jpellis.me>
The previous docstrings did not clearly explain the purpose for the filesystem class. As the examples are intended to be quite pedagogical, the new docstring makes it very clear what it is meant to do/why it exists. Signed-off-by: JP-Ellis <josh@jpellis.me>
Define a new `PactError` base class, and define new errors to encapsulate verification errors. Co-authored-by: valkolovos <val.kolovos@guildeducation.com> Co-authored-by: JP-Ellis <josh@jpellis.me> Signed-off-by: JP-Ellis <josh@jpellis.me>
Signed-off-by: JP-Ellis <josh@jpellis.me>
Instead of returning the iterators themselves, use `yield from` constructs. This helps for two reasons: 1. Avoids needlessly exposing additional classes which serve no other purpose than to iterate over data. 2. Manages the lifetime of the iterators more clearly, preventing possible issues due to the underlying data mutating during iteration. Co-authored-by: valkolovos <val.kolovos@guildeducation.com> Co-authored-by: JP-Ellis <josh@jpellis.me> Signed-off-by: JP-Ellis <josh@jpellis.me>
As messages abstract away the transport layer, it is necessary for Python to directly handle the messages through some user-defined handler. The `verify` method implements this on the consumer side by verifying that each message can be consumed. Co-authored-by: valkolovos <val.kolovos@guildeducation.com> Co-authored-by: JP-Ellis <josh@jpellis.me> Signed-off-by: JP-Ellis <josh@jpellis.me>
Co-authored-by: valkolovos <val.kolovos@guildeducation.com> Co-authored-by: JP-Ellis <josh@jpellis.me> Signed-off-by: JP-Ellis <josh@jpellis.me>
This change also includes a minor fix to ensure that the server is fully started before the test proceeds. Co-authored-by: valkolovos <val.kolovos@guildeducation.com> Co-authored-by: JP-Ellis <josh@jpellis.me> Signed-off-by: JP-Ellis <josh@jpellis.me>
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area:examples
Relating to the examples
area:tests
Relating to the testing
area:v3
Relating to the pact.v3 module
difficulty:hard
A task requiring a lot of work and an in-depth understanding of the codebase
priority:2-high
Must be addressed as soon as possible
type:feature
New feature
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📝 Summary
Massive thanks to @valkolovos for doing most of the heavy lifting in #699 🚀 🚀
The reason for this separate PR is to assist with the generation of the changelog from the conventional Git commit history. Specifically because (1) a squashed commit would be insufficient to encapsulate the extent of the changes, and (2) a rebase-and-merge would be too verbose for the changelog.1
🚨 Breaking Changes
message()
iterator of thePact
class has been removed.🔥 Motivation
🔨 Test Plan
🔗 Related issues/PRs
Footnotes
Unfortunately, it was too difficult to cherry-pick the commits from @valkolovos. As a result, I am marked as the author and committer for these commits, though I have made sure to credit @valkolovos with the
Co-authored-by
trailer. ↩