Open
Description
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
Prerequisites
- I'm using the latest version of
pact-python
. - I have read the console error message carefully (if applicable).
Description
When using MessageConsumer and attempting to set an iso_8601_datetime matcher, the pact file generation fails on Windows. This issue does not occur on Linux, where it works as expected.
Reproducible demo
No response
Steps to reproduce
Run this script on windows:
# consumer.py
from pact import MessageConsumer, Provider, matchers
# Função principal do consumer
def run_consumer():
# Define o contrato do consumer
contract = MessageConsumer(
"my_contract Consumer"
).has_pact_with(
Provider("my_contract Provider"),
pact_dir="pacts",
)
# Define os dados do evento
event_data = {
"invoice_id": "12345",
"amount": 100.00,
"currency": "USD",
"created": matchers.Format().iso_8601_datetime(),
}
# Cria uma mensagem que representa o evento
contract.given("Create contract").expects_to_receive(
"An event of contract").with_content(event_data)
with contract:
pass
if __name__ == "__main__":
run_consumer()
Please note that the file will not be generated.
If you set a breakpoint on message_pact.py, line 193, you can observe that the issue occurs during:
json.dumps(self._messages[0]),
It seems to be something related with regex and json dumps
Remember: it only happens on windows
Expected behavior
The file must be generated on windows
Actual behavior
If matchers.Format().iso_8601_datetime() is used, the local pact file is not being generated on windows
Your environment
Windows 11
Self-service
- I'd be willing to fix this bug myself.
Metadata
Metadata
Assignees
Labels
No labels