Skip to content

Commit 97122f1

Browse files
Merge pull request #13 from pact-foundation/update-developer-documentation
Update the developer instructions
2 parents 3130f9a + 4b0bbd7 commit 97122f1

File tree

1 file changed

+26
-36
lines changed

1 file changed

+26
-36
lines changed

README.md

Lines changed: 26 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -189,41 +189,6 @@ EachLike({
189189
190190
For more information see [Matching](https://docs.pact.io/documentation/matching.html)
191191

192-
## Running the Mock Service
193-
This library does not yet automatically handle running the [Pact Mock Service] so you will need to
194-
start that manually before running the tests. There are two primary ways to run the mock service:
195-
196-
1. [Install it and run it using Ruby](https://github.com/bethesque/pact-mock_service#usage)
197-
2. Run it as a Docker container
198-
199-
Using the Docker container additionally has two options. You can run it via the `docker` command:
200-
201-
```
202-
docker run -d -p "1234:1234" -v /tmp/log:/var/log/pacto -v $(pwd)/contracts:/opt/contracts madkom/pact-mock-service
203-
```
204-
205-
Which will start the service and expose it as port `1234` on your computer, mount
206-
`/tmp/log` on your machine to house the mock service log files, and the directory
207-
`contracts` in the current working directory to house the contracts when they are published.
208-
209-
Additionally, you could run the mock service using `docker-compose`:
210-
211-
```yaml
212-
version: '2'
213-
services:
214-
pactmockservice:
215-
image: madkom/pact-mock-service
216-
ports:
217-
- "1234:1234"
218-
volumes:
219-
- /tmp/pact:/var/log/pacto
220-
- ./contracts:/opt/contracts
221-
```
222-
223-
> Note: How you run the mock service may change what hostname and port you should
224-
> use when running your consumer tests. For example: If you change the host port on
225-
> the command line to be `8080`, your tests would need to contact `localhost:8080`.
226-
227192
## Verifying Pacts Against a Service
228193
> pact-python does not yet have any involvement in the process of verifying a contract against
229194
> a provider. This section is included to provide insight into the full cycle of a
@@ -300,17 +265,42 @@ For more information about provider states, refer to the [Pact documentation] on
300265
# Development
301266
Please read [CONTRIBUTING.md](.github/CONTRIBUTING.md)
302267

303-
Create a Python virtualenv for use with this project
268+
This project needs a combination of Python and Ruby, as the Pact mock service and verifier
269+
are currently Ruby based. To setup a development environment:
270+
271+
1. Install Ruby 2.2.2 using a tool like [rvm] or [rbenv]
272+
2. Install the [bundler] package manager for Ruby with `gem install bundler`
273+
3. If you want to run tests for all Python versions, install 2.7, 3.3, 3.4, 3.5, and 3.6 from source or using a tool like [pyenv]
274+
4. Its recommended to create a Python [virtualenv] for the project
275+
276+
The setup the environment, run tests, and package the application, run:
304277
`make release`
305278

279+
If you are just interested in packaging pact-python so you can install it using pip:
280+
281+
`make package`
282+
283+
This creates a `dist/pact-python-N.N.N.tar.gz` file, where the Ns are the current version.
284+
From there you can use pip to install it:
285+
286+
`pip install ./dist/pact-python-N.N.N.tar.gz`
287+
306288
## Testing
289+
290+
This project has unit and end to end tests, which can both be run from make:
291+
307292
Unit: `make test`
308293

309294
End to end: `make e2e`
310295

296+
[bundler]: http://bundler.io/
311297
[context manager]: https://en.wikibooks.org/wiki/Python_Programming/Context_Managers
312298
[Pact]: https://www.gitbook.com/book/pact-foundation/pact/details
313299
[Pact documentation]: https://docs.pact.io/
314300
[Pact Mock Service]: https://github.com/bethesque/pact-mock_service
315301
[Provider States]: https://docs.pact.io/documentation/provider_states.html
316302
[pact-provider-verifier]: https://github.com/pact-foundation/pact-provider-verifier
303+
[pyenv]: https://github.com/pyenv/pyenv
304+
[rvm]: https://rvm.io/
305+
[rbenv]: https://github.com/rbenv/rbenv
306+
[virtualenv]: http://python-guide-pt-br.readthedocs.io/en/latest/dev/virtualenvs/

0 commit comments

Comments
 (0)