pact-testgen


Namepact-testgen JSON
Version 0.7.0 PyPI version JSON
download
home_pagehttps://github.com/pymetrics/pact-testgen
SummaryGenerate Python test cases from Pact files, for easier provider verification.
upload_time2023-12-09 14:53:36
maintainer
docs_urlNone
authorChris Lawlor
requires_python>=3.7
licenseMIT license
keywords pact_testgen
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            ===================
Pact Test Generator
===================


.. image:: https://img.shields.io/pypi/v/pact-testgen.svg
        :target: https://pypi.python.org/pypi/pact-testgen

.. image:: https://img.shields.io/travis/pymetrics/pact-testgen.svg
        :target: https://travis-ci.com/pymetrics/pact-testgen

.. image:: https://readthedocs.org/projects/pact-testgen/badge/?version=latest
        :target: https://pact-testgen.readthedocs.io/en/latest/?version=latest
        :alt: Documentation Status




Generate Python test cases from Pact files, for easier provider verification.


* Free software: MIT license
* Documentation: https://pact-testgen.readthedocs.io.


Features
--------

* Test Pact contracts against your Python providers via unit tests. Get test isolation *for free*.
* ``pact-testgen`` creates test cases from your Pact files, with placeholders for defining provider states.


Getting Started
---------------

Install with pip
****************

::

    python -m pip install pact-testgen

Generate test files
*******************

Generate a ``provider_states.py`` and ``test_pact.py`` files in your tests directory:

::

    pact-testgen /tests/dir -f /path/to/pactfile.json

For more details, see the Usage_ section of the documentation.

Fill in the generated provider states file
******************************************

In your tests directory (passed as the first argument to ``pact-testgen``), you'll see a file named ``provider_states.py``. It will contain set up
functions matching the provider states defined in your pact file.

Before continuing, complete these functions so that they create the required states.

Run your tests
**************

Run your test suite as normal, being sure to check the the test runner has picked up
your new `test_pact.py` file.


Credits
-------

This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.

Logo `Admiranda Urbis Venetæ`_ from the British Library's King’s Topographical Collection.

Verification of test responses in generated test code is powered by pactman_.

.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
.. _`Admiranda Urbis Venetæ`: https://www.flickr.com/photos/britishlibrary/51196200069/
.. _`pactman`: https://github.com/reecetech/pactman
.. _Usage: https://pact-testgen.readthedocs.io/en/latest/usage.html


=======
History
=======

0.6.0 (2022-10-30)
------------------

* Test against Python 3.10, 3.11

0.5.0 (2022-02-04)
------------------

* Adds Pact Broker support.


0.4.3 (2021-09-20)
------------------

* Fix file handling for merge provider state file option.


0.4.2 (2021-09-18)
------------------

* Improve handling of request data.


0.4.1 (2021-09-17)
------------------

* Fix test method name missing `test_`.


0.4.0 (2021-09-16)
------------------

* Adds option to merge changes to provider state file (Python 3.9 only).
* Include structured provider state parameters from Pact v3 in provider
  state function names.
* Support null provider state, i.e. pact.given(None).


0.3.0 (2021-09-03)
------------------

* Provider state setup functions now raise NotImplementedError by default.
* Format output files with target line length option.
* Improve output to console, add quiet option.


0.2.1 (2021-09-01)
------------------

* Fix test client not setting content type.


0.2.0 (2021-09-01)
------------------

* Improve output for failed test cases.


0.1.2 (2021-08-25)
------------------

* Fix bump2version config


0.1.1 (2021-08-24)
------------------

* Fix templates missing from distributed package.


0.1.0 (2021-08-23)
------------------

* First release on PyPI.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pymetrics/pact-testgen",
    "name": "pact-testgen",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "pact_testgen",
    "author": "Chris Lawlor",
    "author_email": "chris@pymetrics.com",
    "download_url": "https://files.pythonhosted.org/packages/8a/e3/c0c2dbbab009d10384141a217e0bb107f6f13ba05ae2824956287f0c95f1/pact_testgen-0.7.0.tar.gz",
    "platform": null,
    "description": "===================\nPact Test Generator\n===================\n\n\n.. image:: https://img.shields.io/pypi/v/pact-testgen.svg\n        :target: https://pypi.python.org/pypi/pact-testgen\n\n.. image:: https://img.shields.io/travis/pymetrics/pact-testgen.svg\n        :target: https://travis-ci.com/pymetrics/pact-testgen\n\n.. image:: https://readthedocs.org/projects/pact-testgen/badge/?version=latest\n        :target: https://pact-testgen.readthedocs.io/en/latest/?version=latest\n        :alt: Documentation Status\n\n\n\n\nGenerate Python test cases from Pact files, for easier provider verification.\n\n\n* Free software: MIT license\n* Documentation: https://pact-testgen.readthedocs.io.\n\n\nFeatures\n--------\n\n* Test Pact contracts against your Python providers via unit tests. Get test isolation *for free*.\n* ``pact-testgen`` creates test cases from your Pact files, with placeholders for defining provider states.\n\n\nGetting Started\n---------------\n\nInstall with pip\n****************\n\n::\n\n    python -m pip install pact-testgen\n\nGenerate test files\n*******************\n\nGenerate a ``provider_states.py`` and ``test_pact.py`` files in your tests directory:\n\n::\n\n    pact-testgen /tests/dir -f /path/to/pactfile.json\n\nFor more details, see the Usage_ section of the documentation.\n\nFill in the generated provider states file\n******************************************\n\nIn your tests directory (passed as the first argument to ``pact-testgen``), you'll see a file named ``provider_states.py``. It will contain set up\nfunctions matching the provider states defined in your pact file.\n\nBefore continuing, complete these functions so that they create the required states.\n\nRun your tests\n**************\n\nRun your test suite as normal, being sure to check the the test runner has picked up\nyour new `test_pact.py` file.\n\n\nCredits\n-------\n\nThis package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.\n\nLogo `Admiranda Urbis Venet\u00e6`_ from the British Library's King\u2019s Topographical Collection.\n\nVerification of test responses in generated test code is powered by pactman_.\n\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage\n.. _`Admiranda Urbis Venet\u00e6`: https://www.flickr.com/photos/britishlibrary/51196200069/\n.. _`pactman`: https://github.com/reecetech/pactman\n.. _Usage: https://pact-testgen.readthedocs.io/en/latest/usage.html\n\n\n=======\nHistory\n=======\n\n0.6.0 (2022-10-30)\n------------------\n\n* Test against Python 3.10, 3.11\n\n0.5.0 (2022-02-04)\n------------------\n\n* Adds Pact Broker support.\n\n\n0.4.3 (2021-09-20)\n------------------\n\n* Fix file handling for merge provider state file option.\n\n\n0.4.2 (2021-09-18)\n------------------\n\n* Improve handling of request data.\n\n\n0.4.1 (2021-09-17)\n------------------\n\n* Fix test method name missing `test_`.\n\n\n0.4.0 (2021-09-16)\n------------------\n\n* Adds option to merge changes to provider state file (Python 3.9 only).\n* Include structured provider state parameters from Pact v3 in provider\n  state function names.\n* Support null provider state, i.e. pact.given(None).\n\n\n0.3.0 (2021-09-03)\n------------------\n\n* Provider state setup functions now raise NotImplementedError by default.\n* Format output files with target line length option.\n* Improve output to console, add quiet option.\n\n\n0.2.1 (2021-09-01)\n------------------\n\n* Fix test client not setting content type.\n\n\n0.2.0 (2021-09-01)\n------------------\n\n* Improve output for failed test cases.\n\n\n0.1.2 (2021-08-25)\n------------------\n\n* Fix bump2version config\n\n\n0.1.1 (2021-08-24)\n------------------\n\n* Fix templates missing from distributed package.\n\n\n0.1.0 (2021-08-23)\n------------------\n\n* First release on PyPI.\n",
    "bugtrack_url": null,
    "license": "MIT license",
    "summary": "Generate Python test cases from Pact files, for easier provider verification.",
    "version": "0.7.0",
    "project_urls": {
        "Homepage": "https://github.com/pymetrics/pact-testgen"
    },
    "split_keywords": [
        "pact_testgen"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "07609c7d5fa9d1782cbdf7322b60767d3245577f98fee0cb592d0b92a8999b79",
                "md5": "0450b8269eebd8f04adac8f2045c3161",
                "sha256": "6d02627de42715ad2f976777fe7d17512ef204953da3bd4da1bda19ef52759ad"
            },
            "downloads": -1,
            "filename": "pact_testgen-0.7.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0450b8269eebd8f04adac8f2045c3161",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.7",
            "size": 17733,
            "upload_time": "2023-12-09T14:53:35",
            "upload_time_iso_8601": "2023-12-09T14:53:35.030797Z",
            "url": "https://files.pythonhosted.org/packages/07/60/9c7d5fa9d1782cbdf7322b60767d3245577f98fee0cb592d0b92a8999b79/pact_testgen-0.7.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8ae3c0c2dbbab009d10384141a217e0bb107f6f13ba05ae2824956287f0c95f1",
                "md5": "0af80197856113f7ad405e802e7f1311",
                "sha256": "86631e1036440d703095eeb522d5a13e70a74b3afd0770cc05b3bfcecbe9e484"
            },
            "downloads": -1,
            "filename": "pact_testgen-0.7.0.tar.gz",
            "has_sig": false,
            "md5_digest": "0af80197856113f7ad405e802e7f1311",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 113105,
            "upload_time": "2023-12-09T14:53:36",
            "upload_time_iso_8601": "2023-12-09T14:53:36.822222Z",
            "url": "https://files.pythonhosted.org/packages/8a/e3/c0c2dbbab009d10384141a217e0bb107f6f13ba05ae2824956287f0c95f1/pact_testgen-0.7.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-09 14:53:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pymetrics",
    "github_project": "pact-testgen",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "pact-testgen"
}
        
Elapsed time: 0.22329s