-
Notifications
You must be signed in to change notification settings - Fork 137
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
iso_8601_datetime matcher does not work on Windows #850
Comments
Thanks for the bug report and for including an example! Could you please let me know which version of Python you are using? And just to (re)confirm, you are using the latest version of Pact Python? |
yes. Python 3.11 using venv and pact-python 2.2.2 The same problem happens using python 3.10 with conda as env I have tested with diff venv because I was thinkg that could be something related to virtual env. But does not seems to be |
Given this is a Windows-specific issue, can you please help me out and double check the output of the following: from datetime import datetime, timezone
print(datetime.now(tz=timezone.utc).isoformat()) or as a console one-liner: python -c "from datetime import datetime, timezone; print(datetime.now(tz=timezone.utc).isoformat())" |
output: |
Signed-off-by: JP-Ellis <[email protected]>
I am able to replicate your issue, but can't fix it at this stage (though I will keep trying for a bit). Is there any chance you can use the Pact Python v3 interface (form the So my investigation ultimately uncovered the issue to be due to the use of spaces in both the consumer and providers. It is unclear to me why this works on Linux/macOS and not Windows. Most likely, this is actually an issue with the underlying As such, I suspect this won't be fixed in V2; however, I have added warnings into Pact to catch this. Can you please confirm that the space in the name is the issue? Once confirmed, I'll merge #858 and close this issue. |
Signed-off-by: JP-Ellis <[email protected]>
Hey @JP-Ellis , ok. I will use v3. I have tried remove the space at MessageConsumer name, but the issue still happens. So I am not able to confirm it for you |
Discoeverd by user-reported issue in #850. Signed-off-by: JP-Ellis <[email protected]>
So I updated the test in #858 to specifically incorporate the behaviour you are seeing: pact-python/tests/test_issue.py Lines 13 to 44 in da3c9d4
And the CI tests succeeded on all platforms, indicating that the Pact JSON file was created on the Linux and macOS runners, and failed to be created on the Windows runner. Can you make sure that both consumer and provider names have no spaces? As far as I can tell, the issue is unrelated to the ISO 8601 datetime matchers. |
Hey @JP-Ellis, unfortunately, at least in my env, removing the space from provider and consumer name did not solved the issue |
The screenshot shows that you are interrupting the Python process during the invocation of the underlying Your original question was specifically about he ISO 8601 matcher; can you confirm that this is the culprit? I do see that your URL decoded window shows a datetime which is not ISO 8601 compliant; however I do not know where this window comes from. Pycharm may be using its own formatting to display variables during a debug session. Are you able to provide any debug logs? Or better yet, are you able to adapt the example I made in #858 to replicate your issue? So in summary, to try and pinpoint what's going on:
|
Have you read the Contributing Guidelines on issues?
Prerequisites
pact-python
.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:
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
The text was updated successfully, but these errors were encountered: