Skip to content

Feat/interaction implementation#424

Merged
JP-Ellis merged 3 commits intomasterfrom
feat/interaction-impl
Oct 22, 2023
Merged

Feat/interaction implementation#424
JP-Ellis merged 3 commits intomasterfrom
feat/interaction-impl

Conversation

@JP-Ellis
Copy link
Copy Markdown
Contributor

📝 Summary

This adds implementation for all FFI functions which act on an InteractionHandle. Most of these map in Python to a method of the Interaction class.

As the InteractionHandle can point to a HTTP, Sync Message or Async Message Interaction, the initial Interaction class has been converted into an abstract class, and then subclassed into three new concrete classes. This will help end-users specifically when it comes to auto-completions within the IDE.

A couple of minor changes have also been included in this PR in separate commits:

  • chore(test): automatically generated xml coverage

    This can be used by other tools to generate coverage reports, or to annotate code within the IDE.

  • fix(v3): unconventional repr implementation

    The repr implementation should produce one of:

    1. A valid Python string which could be passed to eval() to generate the same object.
    2. A string of the form <{class_name}: {info}>.

    A few of the implementations did not quite adhere to this convention and have been fixed.

🚨 Breaking Changes

Only impacting v3 submodule, which makes not stability guarantees.

🔥 Motivation

Part of the development of Pact Python version 3

🔨 Test Plan

Unit tests have been included, with a couple of caveats:

  • I was unable to get the multipart matching to work. While Pact is set up to expect a multipart payload, I have been unable to get the aiohttp and Pact libraries to generate mutually compatible payloads. As this is one of the lesser used feature, I think it is reasonable for have this merged for now and add a ticket to the backlog.
  • The SyncMessageInteraction and AsyncMessageInteraction are implemented, but only insofar as to test their instantiation. They are not tested any further.

🔗 Related issues/PRs

The __repr__ implementation should produce one of:

1. A valid Python string which could be passed to `eval()` to generate
  the same object.
2. A string of the form `<{class_name}: {info}>`.

A few of the implementations did not quite adhere to this convention and
have been fixed.

Signed-off-by: JP-Ellis <josh@jpellis.me>
This can be used by other tools to generate coverage reports, or to
annotate code within the IDE.

Signed-off-by: JP-Ellis <josh@jpellis.me>
@JP-Ellis JP-Ellis self-assigned this Oct 19, 2023
This commit adds implementation for all FFI functions which act on an
`InteractionHandle`. Most of these map in Python to a method of the
`Interaction` class.

As the InteractionHandle can point to a HTTP, Sync Message or Async
Message Interaction, the initial `Interaction` class has been converted
into an abstract class, and then subclassed into three new concrete
classes. This will help end-users specifically when it comes to
auto-completions within the IDE.

Signed-off-by: JP-Ellis <josh@jpellis.me>
@JP-Ellis JP-Ellis force-pushed the feat/interaction-impl branch from 520378e to 1bb580e Compare October 19, 2023 03:26
Copy link
Copy Markdown

@rholshausen rholshausen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JP-Ellis JP-Ellis merged commit af06815 into master Oct 22, 2023
@JP-Ellis JP-Ellis deleted the feat/interaction-impl branch October 22, 2023 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Completed

Development

Successfully merging this pull request may close these issues.

Implement all FFI methods relating to Interaction

2 participants