Skip to content

Conversation

@JP-Ellis
Copy link
Contributor

📝 Summary

Cleaning up a test and removing an unused function.

🚨 Breaking Changes

🔥 Motivation

🔨 Test Plan

🔗 Related issues/PRs

Signed-off-by: JP-Ellis <josh@jpellis.me>
@JP-Ellis JP-Ellis self-assigned this Nov 20, 2025
Copilot AI review requested due to automatic review settings November 20, 2025 03:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR removes an unused helper function from a test file, simplifying the codebase without affecting functionality.

  • Removed the start_fastapi_server function which was not being used anywhere in the test file.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Nov 20, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
588 1 587 14
View the top 3 failed test(s) by shortest run time
tests.interaction.test_http_interaction::test_basic_response_status[278]
Stack Traces | 0.002s run time
pact = <Pact: consumer='consumer', provider='provider', handle=PactHandle(32356)>
status = 278

    #x1B[0m#x1B[37m@pytest#x1B[39;49;00m.mark.parametrize(#x1B[90m#x1B[39;49;00m
        #x1B[33m"#x1B[39;49;00m#x1B[33mstatus#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
        #x1B[96mlist#x1B[39;49;00m(#x1B[96mrange#x1B[39;49;00m(#x1B[94m200#x1B[39;49;00m, #x1B[94m600#x1B[39;49;00m, #x1B[94m13#x1B[39;49;00m)),#x1B[90m#x1B[39;49;00m
    )#x1B[90m#x1B[39;49;00m
    #x1B[37m@pytest#x1B[39;49;00m.mark.asyncio#x1B[90m#x1B[39;49;00m
    #x1B[94masync#x1B[39;49;00m #x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mtest_basic_response_status#x1B[39;49;00m(pact: Pact, status: #x1B[96mint#x1B[39;49;00m) -> #x1B[94mNone#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
        (#x1B[90m#x1B[39;49;00m
            pact.upon_receiving(#x1B[33mf#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[33ma basic request producing status #x1B[39;49;00m#x1B[33m{#x1B[39;49;00mstatus#x1B[33m}#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m)#x1B[90m#x1B[39;49;00m
            .with_request(#x1B[33m"#x1B[39;49;00m#x1B[33mGET#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m, #x1B[33m"#x1B[39;49;00m#x1B[33m/#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m)#x1B[90m#x1B[39;49;00m
            .will_respond_with(status)#x1B[90m#x1B[39;49;00m
        )#x1B[90m#x1B[39;49;00m
>       #x1B[94mwith#x1B[39;49;00m pact.serve() #x1B[94mas#x1B[39;49;00m srv:#x1B[90m#x1B[39;49;00m

#x1B[1m#x1B[31mtests/interaction/test_http_interaction.py#x1B[0m:89: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31msrc/pact/pact.py#x1B[0m:773: in __enter__
    #x1B[0m#x1B[96mself#x1B[39;49;00m._handle = pact_ffi.create_mock_server_for_transport(#x1B[90m#x1B[39;49;00m
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

pact = PactHandle(32356), addr = 'localhost', port = 47407, transport = 'http'
transport_config = None

    #x1B[0m#x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mcreate_mock_server_for_transport#x1B[39;49;00m(#x1B[90m#x1B[39;49;00m
        pact: PactHandle,#x1B[90m#x1B[39;49;00m
        addr: #x1B[96mstr#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
        port: #x1B[96mint#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
        transport: #x1B[96mstr#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
        transport_config: #x1B[96mstr#x1B[39;49;00m | #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
    ) -> PactServerHandle:#x1B[90m#x1B[39;49;00m
    #x1B[90m    #x1B[39;49;00m#x1B[33m"""#x1B[39;49;00m
    #x1B[33m    Create a mock server for the provided Pact handle and transport.#x1B[39;49;00m
    #x1B[33m#x1B[39;49;00m
    #x1B[33m    [Rust#x1B[39;49;00m
    #x1B[33m    `pactffi_create_mock_server_for_transport`](https://docs.rs/pact_ffi/0.4.28/pact_ffi/?search=pactffi_create_mock_server_for_transport)#x1B[39;49;00m
    #x1B[33m#x1B[39;49;00m
    #x1B[33m    Args:#x1B[39;49;00m
    #x1B[33m        pact:#x1B[39;49;00m
    #x1B[33m            Handle to the Pact model.#x1B[39;49;00m
    #x1B[33m#x1B[39;49;00m
    #x1B[33m        addr:#x1B[39;49;00m
    #x1B[33m            The address to bind to.#x1B[39;49;00m
    #x1B[33m#x1B[39;49;00m
    #x1B[33m        port:#x1B[39;49;00m
    #x1B[33m            The port number to bind to. A value of zero will result in the#x1B[39;49;00m
    #x1B[33m            operating system allocating an available port.#x1B[39;49;00m
    #x1B[33m#x1B[39;49;00m
    #x1B[33m        transport:#x1B[39;49;00m
    #x1B[33m            The transport to use (i.e. http, https, grpc). The underlying Pact#x1B[39;49;00m
    #x1B[33m            library will interpret this, typically in a case-sensitive way.#x1B[39;49;00m
    #x1B[33m#x1B[39;49;00m
    #x1B[33m        transport_config:#x1B[39;49;00m
    #x1B[33m            Configuration to be passed to the transport. This must be a valid#x1B[39;49;00m
    #x1B[33m            JSON string, or `None` if not required.#x1B[39;49;00m
    #x1B[33m#x1B[39;49;00m
    #x1B[33m    Returns:#x1B[39;49;00m
    #x1B[33m        A handle to the mock server.#x1B[39;49;00m
    #x1B[33m#x1B[39;49;00m
    #x1B[33m    Raises:#x1B[39;49;00m
    #x1B[33m        RuntimeError:#x1B[39;49;00m
    #x1B[33m            If the mock server could not be created. The error message will#x1B[39;49;00m
    #x1B[33m            contain details of the error.#x1B[39;49;00m
    #x1B[33m    """#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
        ret: #x1B[96mint#x1B[39;49;00m = lib.pactffi_create_mock_server_for_transport(#x1B[90m#x1B[39;49;00m
            pact._ref,#x1B[90m#x1B[39;49;00m
            addr.encode(#x1B[33m"#x1B[39;49;00m#x1B[33mutf-8#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m),#x1B[90m#x1B[39;49;00m
            port,#x1B[90m#x1B[39;49;00m
            transport.encode(#x1B[33m"#x1B[39;49;00m#x1B[33mutf-8#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m),#x1B[90m#x1B[39;49;00m
            (transport_config.encode(#x1B[33m"#x1B[39;49;00m#x1B[33mutf-8#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m) #x1B[94mif#x1B[39;49;00m transport_config #x1B[94melse#x1B[39;49;00m ffi.NULL),#x1B[90m#x1B[39;49;00m
        )#x1B[90m#x1B[39;49;00m
        #x1B[94mif#x1B[39;49;00m ret > #x1B[94m0#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
            #x1B[94mreturn#x1B[39;49;00m PactServerHandle(ret)#x1B[90m#x1B[39;49;00m
    #x1B[90m#x1B[39;49;00m
        #x1B[94mif#x1B[39;49;00m ret == -#x1B[94m1#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
            msg = #x1B[33mf#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[33mAn invalid Pact handle was received: #x1B[39;49;00m#x1B[33m{#x1B[39;49;00mpact#x1B[33m}#x1B[39;49;00m#x1B[33m.#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
        #x1B[94melif#x1B[39;49;00m ret == -#x1B[94m2#x1B[39;49;00m:  #x1B[90m# noqa: PLR2004#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
            msg = #x1B[33m"#x1B[39;49;00m#x1B[33mInvalid transport_config JSON.#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
        #x1B[94melif#x1B[39;49;00m ret == -#x1B[94m3#x1B[39;49;00m:  #x1B[90m# noqa: PLR2004#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
            msg = #x1B[33mf#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[33mPact mock server could not be started for #x1B[39;49;00m#x1B[33m{#x1B[39;49;00mpact#x1B[33m}#x1B[39;49;00m#x1B[33m.#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
        #x1B[94melif#x1B[39;49;00m ret == -#x1B[94m4#x1B[39;49;00m:  #x1B[90m# noqa: PLR2004#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
            msg = #x1B[33mf#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[33mPanick during Pact mock server creation for #x1B[39;49;00m#x1B[33m{#x1B[39;49;00mpact#x1B[33m}#x1B[39;49;00m#x1B[33m.#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
        #x1B[94melif#x1B[39;49;00m ret == -#x1B[94m5#x1B[39;49;00m:  #x1B[90m# noqa: PLR2004#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
            msg = #x1B[33mf#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[33mAddress is invalid: #x1B[39;49;00m#x1B[33m{#x1B[39;49;00maddr#x1B[33m}#x1B[39;49;00m#x1B[33m.#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
        #x1B[94melse#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
            msg = #x1B[33mf#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[33mAn unknown error occurred during Pact mock server creation for #x1B[39;49;00m#x1B[33m{#x1B[39;49;00mpact#x1B[33m}#x1B[39;49;00m#x1B[33m.#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
>       #x1B[94mraise#x1B[39;49;00m #x1B[96mRuntimeError#x1B[39;49;00m(msg)#x1B[90m#x1B[39;49;00m
#x1B[1m#x1B[31mE       RuntimeError: Pact mock server could not be started for PactHandle(32356).#x1B[0m

#x1B[1m#x1B[.../src/pact_ffi/__init__.py#x1B[0m:5035: RuntimeError
tests.interaction.test_http_interaction::test_with_body_request[PUT]
Stack Traces | 0.003s run time
pact = <Pact: consumer='consumer', provider='provider', handle=PactHandle(40507)>
method = 'PUT'

    #x1B[0m#x1B[37m@pytest#x1B[39;49;00m.mark.parametrize(#x1B[90m#x1B[39;49;00m
        #x1B[33m"#x1B[39;49;00m#x1B[33mmethod#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
        [#x1B[33m"#x1B[39;49;00m#x1B[33mGET#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m, #x1B[33m"#x1B[39;49;00m#x1B[33mPOST#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m, #x1B[33m"#x1B[39;49;00m#x1B[33mPUT#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m],#x1B[90m#x1B[39;49;00m
    )#x1B[90m#x1B[39;49;00m
    #x1B[37m@pytest#x1B[39;49;00m.mark.asyncio#x1B[90m#x1B[39;49;00m
    #x1B[94masync#x1B[39;49;00m #x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mtest_with_body_request#x1B[39;49;00m(pact: Pact, method: #x1B[96mstr#x1B[39;49;00m) -> #x1B[94mNone#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
        (#x1B[90m#x1B[39;49;00m
            pact.upon_receiving(#x1B[33mf#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[33ma basic #x1B[39;49;00m#x1B[33m{#x1B[39;49;00mmethod#x1B[33m}#x1B[39;49;00m#x1B[33m request with a body#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m)#x1B[90m#x1B[39;49;00m
            .with_request(method, #x1B[33m"#x1B[39;49;00m#x1B[33m/#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m)#x1B[90m#x1B[39;49;00m
            .with_body(json.dumps({#x1B[33m"#x1B[39;49;00m#x1B[33mtest#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m: #x1B[94mTrue#x1B[39;49;00m}), #x1B[33m"#x1B[39;49;00m#x1B[33mapplication/json#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m)#x1B[90m#x1B[39;49;00m
            .will_respond_with(#x1B[94m200#x1B[39;49;00m)#x1B[90m#x1B[39;49;00m
        )#x1B[90m#x1B[39;49;00m
>       #x1B[94mwith#x1B[39;49;00m pact.serve() #x1B[94mas#x1B[39;49;00m srv:#x1B[90m#x1B[39;49;00m

#x1B[1m#x1B[31mtests/interaction/test_http_interaction.py#x1B[0m:370: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31msrc/pact/pact.py#x1B[0m:773: in __enter__
    #x1B[0m#x1B[96mself#x1B[39;49;00m._handle = pact_ffi.create_mock_server_for_transport(#x1B[90m#x1B[39;49;00m
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

pact = PactHandle(40507), addr = 'localhost', port = 50225, transport = 'http'
transport_config = None

    #x1B[0m#x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mcreate_mock_server_for_transport#x1B[39;49;00m(#x1B[90m#x1B[39;49;00m
        pact: PactHandle,#x1B[90m#x1B[39;49;00m
        addr: #x1B[96mstr#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
        port: #x1B[96mint#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
        transport: #x1B[96mstr#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
        transport_config: #x1B[96mstr#x1B[39;49;00m | #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
    ) -> PactServerHandle:#x1B[90m#x1B[39;49;00m
    #x1B[90m    #x1B[39;49;00m#x1B[33m"""#x1B[39;49;00m
    #x1B[33m    Create a mock server for the provided Pact handle and transport.#x1B[39;49;00m
    #x1B[33m#x1B[39;49;00m
    #x1B[33m    [Rust#x1B[39;49;00m
    #x1B[33m    `pactffi_create_mock_server_for_transport`](https://docs.rs/pact_ffi/0.4.28/pact_ffi/?search=pactffi_create_mock_server_for_transport)#x1B[39;49;00m
    #x1B[33m#x1B[39;49;00m
    #x1B[33m    Args:#x1B[39;49;00m
    #x1B[33m        pact:#x1B[39;49;00m
    #x1B[33m            Handle to the Pact model.#x1B[39;49;00m
    #x1B[33m#x1B[39;49;00m
    #x1B[33m        addr:#x1B[39;49;00m
    #x1B[33m            The address to bind to.#x1B[39;49;00m
    #x1B[33m#x1B[39;49;00m
    #x1B[33m        port:#x1B[39;49;00m
    #x1B[33m            The port number to bind to. A value of zero will result in the#x1B[39;49;00m
    #x1B[33m            operating system allocating an available port.#x1B[39;49;00m
    #x1B[33m#x1B[39;49;00m
    #x1B[33m        transport:#x1B[39;49;00m
    #x1B[33m            The transport to use (i.e. http, https, grpc). The underlying Pact#x1B[39;49;00m
    #x1B[33m            library will interpret this, typically in a case-sensitive way.#x1B[39;49;00m
    #x1B[33m#x1B[39;49;00m
    #x1B[33m        transport_config:#x1B[39;49;00m
    #x1B[33m            Configuration to be passed to the transport. This must be a valid#x1B[39;49;00m
    #x1B[33m            JSON string, or `None` if not required.#x1B[39;49;00m
    #x1B[33m#x1B[39;49;00m
    #x1B[33m    Returns:#x1B[39;49;00m
    #x1B[33m        A handle to the mock server.#x1B[39;49;00m
    #x1B[33m#x1B[39;49;00m
    #x1B[33m    Raises:#x1B[39;49;00m
    #x1B[33m        RuntimeError:#x1B[39;49;00m
    #x1B[33m            If the mock server could not be created. The error message will#x1B[39;49;00m
    #x1B[33m            contain details of the error.#x1B[39;49;00m
    #x1B[33m    """#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
        ret: #x1B[96mint#x1B[39;49;00m = lib.pactffi_create_mock_server_for_transport(#x1B[90m#x1B[39;49;00m
            pact._ref,#x1B[90m#x1B[39;49;00m
            addr.encode(#x1B[33m"#x1B[39;49;00m#x1B[33mutf-8#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m),#x1B[90m#x1B[39;49;00m
            port,#x1B[90m#x1B[39;49;00m
            transport.encode(#x1B[33m"#x1B[39;49;00m#x1B[33mutf-8#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m),#x1B[90m#x1B[39;49;00m
            (transport_config.encode(#x1B[33m"#x1B[39;49;00m#x1B[33mutf-8#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m) #x1B[94mif#x1B[39;49;00m transport_config #x1B[94melse#x1B[39;49;00m ffi.NULL),#x1B[90m#x1B[39;49;00m
        )#x1B[90m#x1B[39;49;00m
        #x1B[94mif#x1B[39;49;00m ret > #x1B[94m0#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
            #x1B[94mreturn#x1B[39;49;00m PactServerHandle(ret)#x1B[90m#x1B[39;49;00m
    #x1B[90m#x1B[39;49;00m
        #x1B[94mif#x1B[39;49;00m ret == -#x1B[94m1#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
            msg = #x1B[33mf#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[33mAn invalid Pact handle was received: #x1B[39;49;00m#x1B[33m{#x1B[39;49;00mpact#x1B[33m}#x1B[39;49;00m#x1B[33m.#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
        #x1B[94melif#x1B[39;49;00m ret == -#x1B[94m2#x1B[39;49;00m:  #x1B[90m# noqa: PLR2004#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
            msg = #x1B[33m"#x1B[39;49;00m#x1B[33mInvalid transport_config JSON.#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
        #x1B[94melif#x1B[39;49;00m ret == -#x1B[94m3#x1B[39;49;00m:  #x1B[90m# noqa: PLR2004#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
            msg = #x1B[33mf#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[33mPact mock server could not be started for #x1B[39;49;00m#x1B[33m{#x1B[39;49;00mpact#x1B[33m}#x1B[39;49;00m#x1B[33m.#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
        #x1B[94melif#x1B[39;49;00m ret == -#x1B[94m4#x1B[39;49;00m:  #x1B[90m# noqa: PLR2004#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
            msg = #x1B[33mf#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[33mPanick during Pact mock server creation for #x1B[39;49;00m#x1B[33m{#x1B[39;49;00mpact#x1B[33m}#x1B[39;49;00m#x1B[33m.#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
        #x1B[94melif#x1B[39;49;00m ret == -#x1B[94m5#x1B[39;49;00m:  #x1B[90m# noqa: PLR2004#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
            msg = #x1B[33mf#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[33mAddress is invalid: #x1B[39;49;00m#x1B[33m{#x1B[39;49;00maddr#x1B[33m}#x1B[39;49;00m#x1B[33m.#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
        #x1B[94melse#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
            msg = #x1B[33mf#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[33mAn unknown error occurred during Pact mock server creation for #x1B[39;49;00m#x1B[33m{#x1B[39;49;00mpact#x1B[33m}#x1B[39;49;00m#x1B[33m.#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
>       #x1B[94mraise#x1B[39;49;00m #x1B[96mRuntimeError#x1B[39;49;00m(msg)#x1B[90m#x1B[39;49;00m
#x1B[1m#x1B[31mE       RuntimeError: Pact mock server could not be started for PactHandle(40507).#x1B[0m

#x1B[1m#x1B[.../src/pact_ffi/__init__.py#x1B[0m:5035: RuntimeError
tests.compatibility_suite.test_v3_generators::test_supports_a_uuid_generator
Stack Traces | 0.004s run time
fixturefunc = <function the_request_is_prepared_for_use at 0x7f4c2b02c360>
request = <FixtureRequest for <Function test_supports_a_uuid_generator>>
kwargs = {'pact': <Pact: consumer='v3-generators-consumer', provider='v3-generators-provider', handle=PactHandle(10093)>}

    #x1B[0m#x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mcall_fixture_func#x1B[39;49;00m(#x1B[90m#x1B[39;49;00m
        fixturefunc: _FixtureFunc[FixtureValue], request: FixtureRequest, kwargs#x1B[90m#x1B[39;49;00m
    ) -> FixtureValue:#x1B[90m#x1B[39;49;00m
        #x1B[94mif#x1B[39;49;00m inspect.isgeneratorfunction(fixturefunc):#x1B[90m#x1B[39;49;00m
            fixturefunc = cast(Callable[..., Generator[FixtureValue]], fixturefunc)#x1B[90m#x1B[39;49;00m
            generator = fixturefunc(**kwargs)#x1B[90m#x1B[39;49;00m
            #x1B[94mtry#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
                fixture_result = #x1B[96mnext#x1B[39;49;00m(generator)#x1B[90m#x1B[39;49;00m
            #x1B[94mexcept#x1B[39;49;00m #x1B[96mStopIteration#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
                #x1B[94mraise#x1B[39;49;00m #x1B[96mValueError#x1B[39;49;00m(#x1B[33mf#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[33m{#x1B[39;49;00mrequest.fixturename#x1B[33m}#x1B[39;49;00m#x1B[33m did not yield a value#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m) #x1B[94mfrom#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[94mNone#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
            finalizer = functools.partial(_teardown_yield_fixture, fixturefunc, generator)#x1B[90m#x1B[39;49;00m
            request.addfinalizer(finalizer)#x1B[90m#x1B[39;49;00m
        #x1B[94melse#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
            fixturefunc = cast(Callable[..., FixtureValue], fixturefunc)#x1B[90m#x1B[39;49;00m
>           fixture_result = fixturefunc(**kwargs)#x1B[90m#x1B[39;49;00m
                             ^^^^^^^^^^^^^^^^^^^^^#x1B[90m#x1B[39;49;00m

#x1B[1m#x1B[31m..../test/lib/python3.11.../site-packages/_pytest/fixtures.py#x1B[0m:915: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31mtests/compatibility_suite/test_v3_generators.py#x1B[0m:141: in the_request_is_prepared_for_use
    #x1B[0m#x1B[94mwith#x1B[39;49;00m pact.serve() #x1B[94mas#x1B[39;49;00m srv:#x1B[90m#x1B[39;49;00m
#x1B[1m#x1B[31msrc/pact/pact.py#x1B[0m:773: in __enter__
    #x1B[0m#x1B[96mself#x1B[39;49;00m._handle = pact_ffi.create_mock_server_for_transport(#x1B[90m#x1B[39;49;00m
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

pact = PactHandle(10093), addr = 'localhost', port = 57009, transport = 'http'
transport_config = None

    #x1B[0m#x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mcreate_mock_server_for_transport#x1B[39;49;00m(#x1B[90m#x1B[39;49;00m
        pact: PactHandle,#x1B[90m#x1B[39;49;00m
        addr: #x1B[96mstr#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
        port: #x1B[96mint#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
        transport: #x1B[96mstr#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
        transport_config: #x1B[96mstr#x1B[39;49;00m | #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
    ) -> PactServerHandle:#x1B[90m#x1B[39;49;00m
    #x1B[90m    #x1B[39;49;00m#x1B[33m"""#x1B[39;49;00m
    #x1B[33m    Create a mock server for the provided Pact handle and transport.#x1B[39;49;00m
    #x1B[33m#x1B[39;49;00m
    #x1B[33m    [Rust#x1B[39;49;00m
    #x1B[33m    `pactffi_create_mock_server_for_transport`](https://docs.rs/pact_ffi/0.4.28/pact_ffi/?search=pactffi_create_mock_server_for_transport)#x1B[39;49;00m
    #x1B[33m#x1B[39;49;00m
    #x1B[33m    Args:#x1B[39;49;00m
    #x1B[33m        pact:#x1B[39;49;00m
    #x1B[33m            Handle to the Pact model.#x1B[39;49;00m
    #x1B[33m#x1B[39;49;00m
    #x1B[33m        addr:#x1B[39;49;00m
    #x1B[33m            The address to bind to.#x1B[39;49;00m
    #x1B[33m#x1B[39;49;00m
    #x1B[33m        port:#x1B[39;49;00m
    #x1B[33m            The port number to bind to. A value of zero will result in the#x1B[39;49;00m
    #x1B[33m            operating system allocating an available port.#x1B[39;49;00m
    #x1B[33m#x1B[39;49;00m
    #x1B[33m        transport:#x1B[39;49;00m
    #x1B[33m            The transport to use (i.e. http, https, grpc). The underlying Pact#x1B[39;49;00m
    #x1B[33m            library will interpret this, typically in a case-sensitive way.#x1B[39;49;00m
    #x1B[33m#x1B[39;49;00m
    #x1B[33m        transport_config:#x1B[39;49;00m
    #x1B[33m            Configuration to be passed to the transport. This must be a valid#x1B[39;49;00m
    #x1B[33m            JSON string, or `None` if not required.#x1B[39;49;00m
    #x1B[33m#x1B[39;49;00m
    #x1B[33m    Returns:#x1B[39;49;00m
    #x1B[33m        A handle to the mock server.#x1B[39;49;00m
    #x1B[33m#x1B[39;49;00m
    #x1B[33m    Raises:#x1B[39;49;00m
    #x1B[33m        RuntimeError:#x1B[39;49;00m
    #x1B[33m            If the mock server could not be created. The error message will#x1B[39;49;00m
    #x1B[33m            contain details of the error.#x1B[39;49;00m
    #x1B[33m    """#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
        ret: #x1B[96mint#x1B[39;49;00m = lib.pactffi_create_mock_server_for_transport(#x1B[90m#x1B[39;49;00m
            pact._ref,#x1B[90m#x1B[39;49;00m
            addr.encode(#x1B[33m"#x1B[39;49;00m#x1B[33mutf-8#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m),#x1B[90m#x1B[39;49;00m
            port,#x1B[90m#x1B[39;49;00m
            transport.encode(#x1B[33m"#x1B[39;49;00m#x1B[33mutf-8#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m),#x1B[90m#x1B[39;49;00m
            (transport_config.encode(#x1B[33m"#x1B[39;49;00m#x1B[33mutf-8#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m) #x1B[94mif#x1B[39;49;00m transport_config #x1B[94melse#x1B[39;49;00m ffi.NULL),#x1B[90m#x1B[39;49;00m
        )#x1B[90m#x1B[39;49;00m
        #x1B[94mif#x1B[39;49;00m ret > #x1B[94m0#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
            #x1B[94mreturn#x1B[39;49;00m PactServerHandle(ret)#x1B[90m#x1B[39;49;00m
    #x1B[90m#x1B[39;49;00m
        #x1B[94mif#x1B[39;49;00m ret == -#x1B[94m1#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
            msg = #x1B[33mf#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[33mAn invalid Pact handle was received: #x1B[39;49;00m#x1B[33m{#x1B[39;49;00mpact#x1B[33m}#x1B[39;49;00m#x1B[33m.#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
        #x1B[94melif#x1B[39;49;00m ret == -#x1B[94m2#x1B[39;49;00m:  #x1B[90m# noqa: PLR2004#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
            msg = #x1B[33m"#x1B[39;49;00m#x1B[33mInvalid transport_config JSON.#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
        #x1B[94melif#x1B[39;49;00m ret == -#x1B[94m3#x1B[39;49;00m:  #x1B[90m# noqa: PLR2004#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
            msg = #x1B[33mf#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[33mPact mock server could not be started for #x1B[39;49;00m#x1B[33m{#x1B[39;49;00mpact#x1B[33m}#x1B[39;49;00m#x1B[33m.#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
        #x1B[94melif#x1B[39;49;00m ret == -#x1B[94m4#x1B[39;49;00m:  #x1B[90m# noqa: PLR2004#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
            msg = #x1B[33mf#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[33mPanick during Pact mock server creation for #x1B[39;49;00m#x1B[33m{#x1B[39;49;00mpact#x1B[33m}#x1B[39;49;00m#x1B[33m.#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
        #x1B[94melif#x1B[39;49;00m ret == -#x1B[94m5#x1B[39;49;00m:  #x1B[90m# noqa: PLR2004#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
            msg = #x1B[33mf#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[33mAddress is invalid: #x1B[39;49;00m#x1B[33m{#x1B[39;49;00maddr#x1B[33m}#x1B[39;49;00m#x1B[33m.#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
        #x1B[94melse#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
            msg = #x1B[33mf#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[33mAn unknown error occurred during Pact mock server creation for #x1B[39;49;00m#x1B[33m{#x1B[39;49;00mpact#x1B[33m}#x1B[39;49;00m#x1B[33m.#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
>       #x1B[94mraise#x1B[39;49;00m #x1B[96mRuntimeError#x1B[39;49;00m(msg)#x1B[90m#x1B[39;49;00m
#x1B[1m#x1B[31mE       RuntimeError: Pact mock server could not be started for PactHandle(10093).#x1B[0m

#x1B[1m#x1B[.../src/pact_ffi/__init__.py#x1B[0m:5035: RuntimeError
tests.test_server::test_message_get_http
Stack Traces | 0.504s run time
#x1B[0m#x1B[37m@pytest#x1B[39;49;00m.mark.asyncio#x1B[90m#x1B[39;49;00m
    #x1B[94masync#x1B[39;49;00m #x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mtest_message_get_http#x1B[39;49;00m() -> #x1B[94mNone#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
        handler = MagicMock(return_value=#x1B[33mb#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[33mPact Python is awesome!#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m)#x1B[90m#x1B[39;49;00m
        server = MessageProducer(handler)#x1B[90m#x1B[39;49;00m
    #x1B[90m#x1B[39;49;00m
        #x1B[94mwith#x1B[39;49;00m server:#x1B[90m#x1B[39;49;00m
            #x1B[94masync#x1B[39;49;00m #x1B[94mwith#x1B[39;49;00m aiohttp.ClientSession() #x1B[94mas#x1B[39;49;00m session:#x1B[90m#x1B[39;49;00m
                #x1B[94masync#x1B[39;49;00m #x1B[94mwith#x1B[39;49;00m session.get(server.url) #x1B[94mas#x1B[39;49;00m response:#x1B[90m#x1B[39;49;00m
>                   #x1B[94massert#x1B[39;49;00m response.status == #x1B[94m404#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
#x1B[1m#x1B[31mE                   AssertionError: assert 500 == 404#x1B[0m
#x1B[1m#x1B[31mE                    +  where 500 = <ClientResponse(http://localhost:46797/_pact/message) [500 Internal Server Error]>\n<CIMultiDictProxy('Access-Control-A...on; charset=utf-8', 'x-pact': 'Unexpected-Request', 'Content-Length': '373', 'Date': 'Tue, 25 Nov 2025 03:16:24 GMT')>\n.status#x1B[0m

#x1B[1m#x1B[31mtests/test_server.py#x1B[0m:45: AssertionError

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@JP-Ellis JP-Ellis enabled auto-merge (rebase) November 25, 2025 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants