Skip to content

Commit 565bc80

Browse files
committed
chore: added some docs about how to use the e2e example
1 parent 1b4be80 commit 565bc80

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

examples/e2e/README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
11
# Introduction
22

3-
This is an e2e example to show the provider verification working for both cli and python api.
3+
This is an e2e example to show the provider verification working for both cli and python api.
4+
5+
Note in this example we are within conftest we are creating a Broker instance. This is purely to help demonstrate using Pact Broker in the code and you are strongly advised to set up a persistent Broker or use Pactflow
46

57
## Setup
68

79
Create your own virtualenv for this. Run
810

911
```bash
1012
pip install -r requirements.txt
11-
pip install ../../
12-
pytest
13+
pip install -e ../../
14+
./run_pytest.sh
1315
```
1416

15-
This should provide you with a relative path to pact install relatively (2 dirs up)
17+
This should provide you with a relative path to pact install relatively (2 dirs up) You can look at the Makefile in the root folder for more details.
18+
1619

17-
Create the local broker (for demo purposes only) Open a separate terminal in the examples/broker folder and run:
20+
# Running
21+
This example runs broker as part of it's tests. However, if you did wish to create the local broker open a separate terminal in the examples/broker folder and run:
1822
```bash
1923
docker-compose up
2024
```
2125

22-
If you can open a browser to http://localhost and see the broker you have succeeded.
26+
If you can open a browser to http://localhost and see the broker you have succeeded. You will have to remove the fixture in conftest.py to get this for the consumer to work, however.
2327

2428
## Consumer
25-
2629
From the root directory run:
2730

2831
```bash
@@ -40,9 +43,7 @@ To get the consumer to publish a pact to broker you will need to run (2 is an ar
4043
pytest tests/consumer/test_user_consumer.py --publish-pact 2
4144
```
4245

43-
And then you can run:
46+
This example is using the python verifier code. There is an example script of how you could run the verifier cli which would be invoked like:
4447
```bash
4548
./verify_pact.sh 2
46-
```
47-
48-
To verify the pact
49+
```

examples/e2e/tests/conftest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ def pytest_addoption(parser):
1414
help="The url to our provider."
1515
)
1616

17-
17+
# This fixture is to simulate a managed Pact Broker or Pactflow account
18+
# Do not do this yourself but setup one of the above
19+
# https://github.com/pact-foundation/pact_broker
1820
@pytest.fixture(scope='session', autouse=True)
1921
def broker(request):
2022
version = request.config.getoption('--publish-pact')

examples/e2e/tests/consumer/test_user_consumer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ def pact(request):
4242

4343
print('start service')
4444
pact.start_service()
45-
# atexit.register(pact.stop_service)
4645

4746
yield pact
4847
print('stop service')

0 commit comments

Comments
 (0)