Flo Sparrow
Flo Sparrow

Reputation: 31

Pact simple example ad setup issues

Im currently trying to get some very imple python pact examples running. python pact testing example seamed to be the most simple one. So i tried it. Unfortunately im not even getting this one to run properly. And im getting very confused by the requirments. what i did was:

  1. downloaded the project
  2. followed the description and did the install & execution

Im getting the folling error

invoke test_consumer
============================= test session starts ==============================
platform linux2 -- Python 2.7.12, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
rootdir: /home/ubuntu/python-pact-testing-example, inifile:
collected 0 items / 1 errors

==================================== ERRORS ====================================
______________________ ERROR collecting test_consumer.py _______________________
test_consumer.py:11: in <module>
    pact.start_service()
/usr/local/lib/python2.7/dist-packages/pact/pact.py:161: in start_service
    self._process = Popen(command)
/usr/lib/python2.7/subprocess.py:711: in __init__
    errread, errwrite)
/usr/lib/python2.7/subprocess.py:1343: in _execute_child
    raise child_exception
E   OSError: [Errno 2] No such file or directory
!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!
=========================== 1 error in 0.28 seconds ============================

Now i have a couple of questions:

  1. Do i have to install and run the pact mock service independently or should this be done automatically?
  2. Why does the example fail?
  3. Do i need any additional packages?
  4. Is there a detailed guideline or an simple to run example (complete) available?
  5. I pact python mature enough? Just for simple and demostrative issues?

Upvotes: 0

Views: 921

Answers (3)

Matthew Balvanz
Matthew Balvanz

Reputation: 1

The project is definitely in a usable state, and is used to test a couple of professional projects today.

Using the pip install method that python-pact-testing-example outlines in the README should be enough to properly install pact-python. During that install process it will download a separate package to do the actual contract work.

There is a chance that something happened with the download of that package that caused the mock service to not get installed on your machine, but looking at the code today I think it should have blown up during install. We could certainly look at making this situation more friendly, by telling you which file is missing and that it could be an install issue. If that is the issue, this may resolve the issue:

pip uninstall pact-python pip install pact-python

If you are looking for an example, you might check out the end to end tests of pact-python. These illustrate a lot of the major features of the project and run during the build process.

Upvotes: 0

Flo Sparrow
Flo Sparrow

Reputation: 31

I figured, that the error i got might be some kind of configuration issue. With Python 3.5 and these logged dependencies, the example ran through:

attrs==17.4.0
certifi==2018.4.16
chardet==3.0.4
click==6.7
flask==0.12.2
idna==2.6
invoke==0.22.1
itsdangerous==0.24
jinja2==2.10
markupsafe==1.0
more-itertools==4.1.0
pact-python==0.16.1
pluggy==0.6.0
psutil==5.4.5
py==1.5.3
pytest==3.5.1
requests==2.18.4
six==1.11.0
urllib3==1.22
werkzeug==0.14.1

However, this does not answer my initial question. And im still not sure whether my current configuration is stable.

Upvotes: 0

Beth Skurrie
Beth Skurrie

Reputation: 1318

Can I suggest raising an issue in the repository itself? The last commit date is 28 Jun 2017, and pact-python has undergone a great deal of development in the last year and a half. Unfortunately, there are no versions specified in the requirements.txt. My gut feel is that the example is out of date.

Upvotes: 1

Related Questions