Conftest¶
Shared PyTest configuration.
In order to run the examples, we need to run the Pact broker. In order to avoid having to run the Pact broker manually, or repeating the same code in each example, we define a PyTest fixture to run the Pact broker.
We also define a pact_dir
fixture to define the directory where the generated
Pact files will be stored. You are encouraged to have a look at these files
after the examples have been run.
Attributes¶
EXAMPLE_DIR = Path(__file__).parent.resolve()
module-attribute
¶
Functions¶
broker(request: pytest.FixtureRequest) -> Generator[URL, Any, None]
¶
Fixture to run the Pact broker.
This inspects whether the --broker-url
option has been given. If it has,
it is assumed that the broker is already running and simply returns the
given URL.
Otherwise, the Pact broker is started in a container. The URL of the containerised broker is then returned.