https://pact.io logo
Join Slack
Powered by
# pact-python
  • g

    GitHub

    03/05/2023, 10:48 PM
    #270 Examples: remove misleading use of PACT_MOCK variables in examples Issue created by mefellows The fastapi example (and perhaps the others) are a little misleading to newbies. The following lines would suggest that there is pact mock on the provider side, when in reality this is the address of the locally running FastAPI provider:
    Copy code
    PACT_MOCK_HOST = 'localhost'
    PACT_MOCK_PORT = 8000
    PACT_URL = "http://{}:{}".format(PACT_MOCK_HOST, PACT_MOCK_PORT)
    I'd suggest changing these to
    PROVIDER_HOST
    ,
    PROVIDER_PORT
    and
    PROVIDER_URL
    respectively, perhaps with a comment explaining these map to the default host/port combination of the provider. See this thread for context: https://pact-foundation.slack.com/archives/C9VECUP6E/p1633686950075000 pact-foundation/pact-python
    • 1
    • 1
  • m

    Mike Geeves

    03/05/2023, 11:01 PM
    🎉
    😆 2
  • g

    GitHub

    03/06/2023, 10:21 AM
    #332 No way to verify with a specific pact Issue created by ims-swilkinson I'm using
    pact-python
    version 1.7.0. There doesn't seem to be a way to verify with a specific pact by passing in a pact URL. I tried passing a
    pact_url
    kwarg into
    MessageProvider.verify_with_broker
    but this always gives me the error
    pact.verify_wrapper.PactException: Pact urls or Pact broker required
    . pact-foundation/pact-python
  • f

    Facu Conejero

    03/08/2023, 9:31 AM
    @Facu Conejero has left the channel
  • s

    Serghei Iakovlev

    03/10/2023, 9:57 AM
    I’m sorry for my annoyance, but I’m just curious about the SDLC of pact-python. My questions may seem naive, I apologize in advance. This is due to my lack of understanding of current workflow. Does anyone do full-time development of pact-python? Who is the official maintainer? How often are pull requests/issues considered/merged (monthly, quarterly, yearly, etc)? Where can I see the current roadmap? Is this project in a state of stagnation? I probably jumped the gun when I promised @Steve Wilkinson I’d take care of it. Now, having analyzed the activity of the project, I am more inclined to think that my contribution may be considered a bit (too) late, when it will no longer be relevant at all. Frankly, I don’t have a lot of free time, and I’d like to use it where my help really needed. I hope my doubts are clear.
    y
    e
    m
    • 4
    • 13
  • g

    GitHub

    03/12/2023, 3:08 PM
    #333 feat: add matchers for ISO 8601 date format Pull request opened by sergeyklay This introduces
    pact.Format.iso_8601_datetime()
    method to match a string for a full ISO 8601 Date. This method does not do any sort of date validation, only checks if the string is according to the ISO 8601 spec. It differs from
    pact.Format.timestamp
    ,
    pact.Format.date
    and
    pact.Format.time
    implementations in that it is more stringent and tests the string for exact match to the ISO 8601 dates format. Without
    with_ms
    parameter will match string containing ISO 8601 formatted dates as stated bellow: • 2016-12-15T201601 • 2010-05-01T011431.876 • 2016-05-24T155414.00000Z • 1994-11-05T081530-05:00 • 2002-01-31T230000.1234-02:00 • 1991-02-20T063526.079043+00:00 Otherwise, ONLY dates with milliseconds will match the pattern: • 2010-05-01T011431.876 • 2016-05-24T155414.00000Z • 2002-01-31T230000.1234-02:00 • 1991-02-20T063526.079043+00:00 This change aims to bring the capabilities of the python library into alignment with pact-foundation/docs.pact.io#88, since the existing functionality is a bit liberal and allows tests to pass even in cases where the dates do not conform to the ISO 8601 spec. pact-foundation/pact-python GitHub Actions: build (3.10) GitHub Actions: build (3.7) ✅ 3 other checks have passed 3/5 successful checks
  • g

    GitHub

    03/12/2023, 10:28 PM
    #334 feat: provide ability to verify with a specific pact Pull request opened by sergeyklay This change adds the ability to verify pacts by passing their URI to verify. The URI of the every pact can be an HTTP URI or a local file path. Fixes #332 pact-foundation/pact-python GitHub Actions: Python 3.6 on ubuntu-20.04 GitHub Actions: Python 3.11 on ubuntu-latest GitHub Actions: Python 3.10 on ubuntu-latest GitHub Actions: Python 3.9 on ubuntu-latest GitHub Actions: Python 3.8 on ubuntu-latest GitHub Actions: Python 3.7 on ubuntu-latest ✅ 1 other check has passed 1/7 successful checks
    s
    m
    • 3
    • 3
  • c

    Christine Awofeso

    03/16/2023, 4:16 PM
    Hi we would like to do verification for v4 contracts via python, however at the moment the pact-python does not support v4. I can see there is on the project board that this is something you are wanting to implement. Is there any updates on this, is there any way one can easily contribute to speed things up? thanks 🙂
    y
    • 2
    • 4
  • k

    Kripa Kurian

    03/16/2023, 7:31 PM
    @Kripa Kurian has left the channel
  • g

    GitHub

    03/17/2023, 10:26 AM
    #335 feat(test): add docker images for Python 3.9-3.11 for testing purposes Pull request opened by sergeyklay This pull request introduces the ability to build Docker images for Python versions 3.9, 3.10, and 3.11. Additionally, it unifies the existing images to ensure consistency and maintainability. The documentation has been proofread for clarity and accuracy, and the build instructions have been updated to reflect these new changes. pact-foundation/pact-python ✅ All checks have passed 7/7 successful checks
    • 1
    • 1
  • u

    Ulises Cervino

    03/22/2023, 9:01 PM
    @Ulises Cervino has left the channel
  • q

    Quinton Miller

    03/23/2023, 7:21 PM
    Hello, I am trying to verify my pact contracts in my Python project and am having some trouble. In the docstrings in
    verifiers.py
    it says that the verify_with_broker function is supposed to return true if there are no issues. However, the readme shows that the function should return
    0
    . Which one is correct?
    m
    • 2
    • 1
  • m

    Melike Sezin

    03/28/2023, 2:02 PM
    Hello, I'm trying to understand how Matcher works for pact-python. Apparently I cannot use Like, SomethingLike, Term etc. for matching keys in json responses. In below example, I'll have at least 1 node in response, where the node id can have any value (in the example there are 3 nodes with ids 1, 2, 3). Is there a way to make this work? expected = { "nodes": { "1": { "description": SomethingLike("description"), "classification": SomethingLike("classification") }, "2": { "description": SomethingLike("description"), "classification": SomethingLike("classification") }, "3": { "description": SomethingLike("description"), "classification": SomethingLike("classification") } } }
    s
    m
    • 3
    • 15
  • g

    GitHub

    03/29/2023, 6:56 PM
    #253 Pact broker support for the MessageProvider Issue created by selin194 As I understand, MessageProvider verifies pacts only for the given pacts directory . Is there any way to achieve verification using pact-broker for the MessageProvider like using Verifier? Thank you! pact-foundation/pact-python
    • 1
    • 1
  • g

    GitHub

    03/29/2023, 6:56 PM
    #268 Add support for publishing pacts with a branch Issue created by bethesque Feature description Support publishing pacts with branches and a build_url. This may not be necessary if the native "wrapper" bit of the publishing is not supported, but thought I'd raise it anyway for discussion. Use case See https://github.com/pact-foundation/docs.pact.io/blob/feat/deployments-and-releases/website/blog/2021-07-04-why-we-are-getting-rid-of-tags.md Details • To the user facing Pact API, add: • String
    branch
    • String
    buildUrl
    • Boolean
    autoDetectVersionProperties
    • Pass the new properties through to the pact-ruby-standalone publish command as: •
    branch
    as the
    --branch
    property •
    buildUrl
    as`--build-url` •
    autoDetectVersionProperties
    as
    --auto-detect-version-properties
    only if autoDetectVersionProperties is true • To verify that this is working: • publish a pact with a branch to a Pact Broker version 2.86.0+ • Open the index page • Click on the integration • You should see the pact that you have just published with a branch slug next to the consumer version number • The build URL is currently only used in the webhook - as long as you can see it being passed through to the CLI, this should be sufficient. pact-foundation/pact-python
    • 1
    • 1
  • g

    GitHub

    03/29/2023, 6:58 PM
    #304 FileNotFoundError: [Errno 2] No such file or directory: /pact-python-master/pact/bin/pact/bin/pact-mock-service when running Pact test Issue created by allinone-1 Python 3.6.2, pytest-5.4.1, py-1.11.0, pluggy-0.13.1 Docker version 20.10.9, build c2ea9bc pact.start_service() ERROR self = <subprocess.Popen object at 0x7efd92d3ea90> args = ['/home/contract_test/pact-python-master/pact/bin/pact/bin/pact-mock-service', 'service', '--host=localhost', '--port=1234', '--log', '/home/contract_test/pact-python-master/examples/consumer/pact-mock-service.log', ...] executable = b'/home/contract_test/pact-python-master/pact/bin/pact/bin/pact-mock-service', preexec_fn = None close_fds = True, pass_fds = (), cwd = None, env = None, startupinfo = None, creationflags = 0, shell = False, p2cread = -1 p2cwrite = -1, c2pread = -1, c2pwrite = -1, errread = -1, errwrite = -1, restore_ How do I generate this file?pact/bin/pact-mock-service pact-foundation/pact-python
    • 1
    • 1
  • g

    GitHub

    03/29/2023, 6:59 PM
    #229 pact-verifier failed when running Issue created by xiaobeon INFO: Reading pact at ./pact_file/la-provider.json Verifying a pact between Ls and Provider A request for getcurrentlasubject with GET /api/getLsSubject returns a response which has status code 200 (FAILED - 1) has a matching body (FAILED - 2) Failures: 1. Verifying a pact between Ls and Provider A request for getcurrentlasubject with GET /api/getLsSubject returns a response which has status code 200 Failure/Error: replay_interaction interaction, options[:request_customizer] NoMethodError: undefined method `strip' for nil:NilClass 2. Verifying a pact between Ls and Provider A request for getcurrentlasubject with GET /api/getLsSubject returns a response which has a matching body Failure/Error: replay_interaction interaction, options[:request_customizer] NoMethodError: undefined method `strip' for nil:NilClass 1 interaction, 1 failure pact-foundation/pact-python
    • 1
    • 1
  • g

    GitHub

    03/29/2023, 7:38 PM
    3 new commits pushed to
    <https://github.com/pact-foundation/pact-python/tree/master|master>
    by sergeyklay
    <https://github.com/pact-foundation/pact-python/commit/a219f49ce34c82b6b148e3c18b8c65219c8b234f|a219f49c>
    - fix: actualize doc on how to make contributions
    <https://github.com/pact-foundation/pact-python/commit/60f2aacf28f831004f65a860f6ad0eb5bab7a89f|60f2aacf>
    - doc: correct links in contributing manual
    <https://github.com/pact-foundation/pact-python/commit/bea156392d55f85111a44c179460e111d05a137a|bea15639>
    - doc: improve commit messages guide pact-foundation/pact-python
  • g

    GitHub

    03/30/2023, 9:24 AM
    #336 EachLike implementation for unknown keys Issue created by sergeyklay Ref: https://pact.canny.io/feature-requests/p/eachlike-implementation-for-unknown-keys pact-foundation/pact-python
  • g

    GitHub

    03/30/2023, 9:35 AM
    #261 Pact-Verifier : ValueError: 'default' must be a list when 'multiple' is true. Issue created by ssshauryaa Running Pact-Verifier commands throws this error. pact-python version is 1.3.1. root# pact-verifier --help Traceback (most recent call last): File "/root/.pyenv/versions/3.6.3/bin/pact-verifier", line 33, in sys.exit(load_entry_point('pact-python==1.3.1', 'console_scripts', 'pact-verifier')()) File "/root/.pyenv/versions/3.6.3/bin/pact-verifier", line 25, in importlib_load_entry_point return next(matches).load() File "/root/.pyenv/versions/3.6.3/lib/python3.6/site-packages/importlib_metadata/*init*.py", line 194, in load module = import_module(match.group('module')) File "/root/.pyenv/versions/3.6.3/lib/python3.6/importlib/*init*.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/root/.pyenv/versions/3.6.3/lib/python3.6/site-packages/pact/cli/verify.py", line 122, in help='Automatically include the pending pacts in the verification step. ' File "/root/.pyenv/versions/3.6.3/lib/python3.6/site-packages/click/decorators.py", line 247, in decorator _param_memo(f, OptionClass(param_decls, **option_attrs)) File "/root/.pyenv/versions/3.6.3/lib/python3.6/site-packages/click/core.py", line 2482, in init super().*init*(param_decls, type=type, multiple=multiple, **attrs) File "/root/.pyenv/versions/3.6.3/lib/python3.6/site-packages/click/core.py", line 2110, in init ) from None ValueError: 'default' must be a list when 'multiple' is true. pact-foundation/pact-python
    • 1
    • 1
  • g

    GitHub

    03/30/2023, 9:44 AM
    #290 encode&amp;decode error when using pact-verifier command Issue created by mikiihuang hi,I am using pact-python,version 1.5.0.When generating pact json files,it shows like:'
    Copy code
    D:/python/Lib/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/logger.rb:513: warning: failed to load encoding (CP936); use ASCII-8BIT instead
    D:/python/Lib/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/logger.rb:513: warning: failed to load encoding (CP936); use ASCII-8BIT instead
    `
    though it did generate a json file. But if I define error Expected deliberately in contract python file, when using pact-verifier in cmd, it shows: ``` `d\python\Lib\site packages\pact\bin\pact\lib\ruby\bin\..\bin.real\ruby.exe warning: failed to load encoding (CP936); use ASCII-8BIT instead d\python\Lib\site packages\pact\bin\pact\lib\ruby\bin\..\bin.real\ruby.exe warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/rubygems.rb1028: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler/shared helpers.rb98: warning: failed to load encoding (CP936); use ASCII-8BIT i nstead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d/python/Lib/site packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler 1.9.9/lib/bundler.rb13: warning: failed to load encoding (CP936); use ASCII-8BIT instead d:/python/Lib/site-packages/pact/bin/pact/lib… pact-foundation/pact-python
    • 1
    • 1
  • g

    GitHub

    03/30/2023, 8:50 PM
    #65 pact-verifier fails when running against a service using SSL Issue created by ewortzman I am attempting to verify my contract against a running provider. The provider uses SSL verification, and When I run
    pact-verifier
    , all I get is a bunch of SSL errors.
    pact-verifier
    does not provide a way to disable SSL verification. ``` Failures: 1) Verifying a pact between consumer and provider Given A service is deployed A request for a service with GET /api/services/contract/test/my_service returns a response which has status code 200 Failure/Error: replay_interaction interaction OpenSSL:SSLSSLError SSL_connect returned=1 errno=0 state=error: certificate verify failed # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb923in `connect' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb923in `block in connect' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/timeout.rb74in `timeout' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb923in `connect' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb863in `do_start' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb858in `start' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rack-proxy-0.6.1/lib/rack/http_streaming_response.rb71in `session' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rack-proxy-0.6.1/lib/rack/http_streaming_response.rb60in `response' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rack-proxy-0.6.1/lib/rack/http_streaming_response.rb29in `headers' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-proxy-2.1.0/vendor/rack-reverse-proxy/lib/rack/reverse_proxy.rb77in `proxy' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-proxy-2.1.0/vendor/rack-reverse-proxy/lib/rack/reverse_proxy.rb29in `call' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rack-test-0.6.3/lib/rack/mock_session.rb30in `request' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rack-test-0.6.3/lib/rack/test.rb244in `process_request' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rack-test-0.6.3/lib/rack/test.rb58in `get' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.14.0/lib/pact/provider/test_methods.rb23in `replay_interaction' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.14.0/lib/pact/provider/rspec.rb82in `block (4 levels) in describe_interaction' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.14.0/lib/pact/provider/rspec.rb171in `run_once' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.14.0/lib/pact/provider/rspec.rb79in `block (3 levels) in describe_interaction' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/example.rb447in `instance_exec' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/example.rb447in `instance_exec' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb350in `run' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb507in `block in run_owned_hooks_for' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb506in `each' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb506in `run_owned_hooks_for' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb593in `block in run_example_hooks_for' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb592in `reverse_each' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb592in `run_example_hooks_for' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb462in `run' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/example.rb494in `run_before_example' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/example.rb253in `block in run' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/example.rb500in `block in with_around_and_singleton_context_hooks' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/example.rb457in `block in with_around_example_hooks' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb464in `block in run' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb602in `run_around_example_hooks_for' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb464in `run' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/example.rb457in `with_around_example_hooks' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/example.rb500in `with_around_and_singleton_context_hooks' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/example.rb251in `run' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb627in `block in run_examples' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb623in `map' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb623in `run_examples' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb589in `run' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb590in `block in run' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb590in `map' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb590in `run' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb590in `block in run' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb590in `map' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb590in `run' # /usr/local/lib/python2.7/dist-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/rspec-core-3.6.0/lib/rspec/core/exampl… pact-foundation/pact-python
    • 1
    • 1
  • g

    GitHub

    03/30/2023, 8:55 PM
    #81 Discrepancy in encoding of JSON between Python and Ruby Issue created by stefankraus-wf I am unable to run contract tests between two python services that authenticate using HMAC keys due to the serialization differences between the actual requests and the mocked request provided by the pact-verifier. I have a Consumer test that signs requests with an HMAC:
    Copy code
    request = requests.Request(
      method=’POST’, url=’<http://localhost>’, json={‘test’: ‘a’})
    prep = request.prepare() 
    signature = hmac.new(‘abc123’.encode('utf-8'),
                         msg=prep.body,
                         digestmod=hashlib.sha512).hexdigest()
    prep.headers['Request-Signature'] = signature
    resp = requests.session().send(prep) 
    return resp
    And a Provider that verifies that HMAC:
    Copy code
    @blueprint.route(‘/’, methods=[‘POST’])
    def handle():
      ...
      signature = hmac.new(
        ‘abc123’.encode(‘utf-8’),
        msg=body,
        digestmod=hashlib.sha512).hexdigest()
      # if signature != request.headers.get('Request-Signature`):
        # abort(401)
    At the HTTP level, what is being sent from the Consumer is exactly: ‘{“status”: “e”}’ However, what is being received by the Provider is exactly: ‘{“status”:”e”}’ This would not be a problem under normal circumstances since the json encoder is ambivalent to whitespace. However, in the case of HMAC keys where the exact byte sequence of the request body is used it causes failures to authenticate. The json contract spec that I get from running the Consumer unit tests is:
    Copy code
    "interactions": [
        {
          "description": "<test request>",
          "providerState": "<state>",
          "request": {
            "method": "post",
            "path": "/",
            "headers": {
              "Content-Type": "application/json",
              "Request-Signature": "<sig>"
            },
            "body": {
              "test": "a"
            }
          },
          "response": {
            "status": 200,
            "headers": {
            },
            "body": [
              "Success",
              200
            ]
          }
        },
    …
      ]
    }
    pact-foundation/pact-python
    • 1
    • 1
  • g

    Gokul Muralikrishnan

    03/31/2023, 5:25 PM
    Hi All, I am new to this topic. Planning to implement in my micro service project. I am seeing consumer verification using mock server in pact python. Can we continue the same for provider verification with pact file? Is there any GitHub location to understand on it? Interested to learn more on contract test using pact.io with python. Kindly help.
    s
    • 2
    • 2
  • g

    GitHub

    03/31/2023, 8:36 PM
    4 new commits pushed to
    <https://github.com/pact-foundation/pact-python/tree/master|master>
    by sergeyklay
    <https://github.com/pact-foundation/pact-python/commit/7603815b674a86c7cd243727f707c9466b6f738b|7603815b>
    - ci: add python 3.11 to test matrix
    <https://github.com/pact-foundation/pact-python/commit/4d9f4cd88f0b04a8afa38916386daeeff7942412|4d9f4cd8>
    - feat: describe classifiers and python version for pypi package
    <https://github.com/pact-foundation/pact-python/commit/348bf5e41c9b4df8e68a66e6d1896a7a8f78c608|348bf5e4>
    - build: use compatible dependency versions for Python 3.6
    <https://github.com/pact-foundation/pact-python/commit/f7c50063019c096b5507a45582a693a5a8cfbea6|f7c50063>
    - docs: add Python 3.11 to CONTRIBUTING.md pact-foundation/pact-python
  • g

    GitHub

    03/31/2023, 8:36 PM
    #311 add support for Python 3.11 Pull request opened by gruebel there was one deprecation warning when I ran
    tox -e py311
    it was related to an old
    coverage
    version, so updated it to a newer one, where it was fixed 🙂 pact-foundation/pact-python ✅ All checks have passed 1/1 successful checks
    • 1
    • 1
  • g

    GitHub

    04/02/2023, 7:44 PM
    2 new commits pushed to
    <https://github.com/pact-foundation/pact-python/tree/master|master>
    by sergeyklay
    <https://github.com/pact-foundation/pact-python/commit/26eaaac2e326b57fb9413d440ecd7f7c065d0783|26eaaac2>
    - fix: remove dead code
    <https://github.com/pact-foundation/pact-python/commit/28fc7d3e499fd203280edc4c3a901be765c6496d|28fc7d3e>
    - docs: fix link for GitHub badge pact-foundation/pact-python
  • g

    GitHub

    04/02/2023, 10:07 PM
    4 new commits pushed to
    <https://github.com/pact-foundation/pact-python/tree/master|master>
    by sergeyklay
    <https://github.com/pact-foundation/pact-python/commit/55dcaf25779aae4b68c307c88ce640fd6ab17ae6|55dcaf25>
    - feat(test): add docker images for Python 3.9-3.11 for testing purposes
    <https://github.com/pact-foundation/pact-python/commit/24c2dbf1437e1aa5937153f40b80498dea06b3d0|24c2dbf1>
    - docs: fix instruction to build python 3.11 image
    <https://github.com/pact-foundation/pact-python/commit/a5d3a2e689f3cf0a9c4624233feae0a77382cf10|a5d3a2e6>
    - docs: paraphrase the instructions for running the tests
    <https://github.com/pact-foundation/pact-python/commit/e99e7fb0fa4abce69c9cfcd47eb9e3afe0351681|e99e7fb0>
    - docs: rephrase the instructions for running the tests pact-foundation/pact-python
  • m

    Matt (pactflow.io / pact-js / pact-go)

    04/03/2023, 12:13 AM
    Awesome work @Serghei Iakovlev, @Mike Geeves and @Elliott Murray !
    🙌 1
    👍 1
  • g

    GitHub

    04/03/2023, 6:24 AM
    #337 Set language/version for telemetry data Issue created by mefellows Currently, Pact Python uses the Ruby shared core which emits telemetry to GA for maintainers to understand feature usage and language support. This currently is unaware of the host environment, meaning we can't get fidelity of metrics around Pact Python. Please set the following environment variables prior to executing consumer/provider tests (e.g. somewhere early on in the execution chain): •
    PACT_EXECUTING_LANGUAGE
    to
    python
    •
    PACT_EXECUTING_LANGUAGE_VERSION
    to the version of running python environment (e.g.
    3.11
    ). See example PR here: pact-foundation/pact-js-core#359 pact-foundation/pact-python
1234567Latest