pytest-pyramid


Namepytest-pyramid JSON
Version 1.0.2 PyPI version JSON
download
home_page
Summarypytest_pyramid - provides fixtures for testing pyramid applications with pytest test suite
upload_time2022-12-13 14:24:59
maintainer
docs_urlNone
author
requires_python>=3.8
licenseThe MIT License (MIT): http://opensource.org/licenses/MIT Copyright (c) 2013 by pytest_pyramid authors and contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords pyramid pytest testing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. image:: https://raw.githubusercontent.com/fizyk/pytest_pyramid/master/logo.png
    :width: 100px
    :height: 100px

pytest_pyramid
==============

.. image:: https://img.shields.io/pypi/v/pytest_pyramid.svg
    :target: https://pypi.python.org/pypi/pytest_pyramid/
    :alt: Latest PyPI version

.. image:: https://img.shields.io/pypi/wheel/pytest_pyramid.svg
    :target: https://pypi.python.org/pypi/pytest_pyramid/
    :alt: Wheel Status

.. image:: https://img.shields.io/pypi/pyversions/pytest_pyramid.svg
    :target: https://pypi.python.org/pypi/pytest_pyramid/
    :alt: Supported Python Versions

.. image:: https://img.shields.io/pypi/l/pytest_pyramid.svg
    :target: https://pypi.python.org/pypi/pytest_pyramid/
    :alt: License

pytest_pyramid provides basic fixtures for testing pyramid applications with pytest test suite.

By default, pytest_pyramid will create two fixtures: pyramid_config, which creates configurator based on config.ini file, and pyramid_app, which creates TestApp based on Configurator returned by pyramid_config.

Command line options
--------------------

* **--pc** - pyramid configuration file based on which pytest_pyramid will create test app

Usage
=====

For the most basic usage, pytest_pyramid provides pyramid_app and pyramid_config fixtures,
that can be used to test your pyramid app.
Simply pass your pyramid config ***.ini** file to **--pc** command-line option,
and include *pytest_app* fixture into your test suite to be able to use it for
integration tests.

Fixtures
--------

pytest_pyramid provides two fixtures to be used in pytest tests:

* **pyramid_config** - fixture providing pyramid's Configurator instance as
  defined in pyramid config's file
* **pyramid_app** - pyramid application for testing - a **webtest.app.TestApp**

Both of these fixtures depend on the Config file passed in the command line.


Fixture factories
-----------------

If you're developing a module, package meant to extend functionalities of other
applications, it's not necessary to create a full-blown application to test
functionalities provided in packages. To do this, **pytest_pyramid** provides
you with fixture **pytest_pyramid.factories**.

There are two factories:

* **pytest_pyramid.factories.pyramid_config** provides you with Configuration object based on either settings, config_file argument, or by --pc command-line option config file.
* **pytest_pyramid.factories.pyramid_app** creates a **webtest.app.TestApp** based on Configurator class instance as returned from fixture passed by name to it. It also accepts additional fixtures that should be loaded before the `pyramid_app`. See the example with `postgresql` below.

.. code-block:: python

    from pytest_postgresql.plugin import postgresql
    from pytest_pyramid import factories

    app_config = factories.pyramid_config(config_path="development.ini")
    app_with_postgres = factories.pyramid_app("app_config", "postgresql")

    def test_pyramid_app(app_with_postgres):
        res = app_with_postgres.get('/', status=404)
        assert res.status_code == 404


TODO
----

#. provide a pyramid_proc fixture that will start pyramid app process using summon_process


Tests
-----

To run tests run this command:

`pytest --pc tests/pyramid.test.ini`

Release
=======

Install pipenv and --dev dependencies first, Then run:

.. code-block::

    pipenv run tbump [NEW_VERSION]

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pytest-pyramid",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "pyramid,pytest,testing",
    "author": "",
    "author_email": "Grzegorz \u015aliwi\u0144ski <fizyk+pypi@fizyk.dev>",
    "download_url": "https://files.pythonhosted.org/packages/20/82/b83c3ece75f3528e69fb33bd21bd5dd63eeec38d2e0a373f778e321d2ab5/pytest_pyramid-1.0.2.tar.gz",
    "platform": null,
    "description": ".. image:: https://raw.githubusercontent.com/fizyk/pytest_pyramid/master/logo.png\n    :width: 100px\n    :height: 100px\n\npytest_pyramid\n==============\n\n.. image:: https://img.shields.io/pypi/v/pytest_pyramid.svg\n    :target: https://pypi.python.org/pypi/pytest_pyramid/\n    :alt: Latest PyPI version\n\n.. image:: https://img.shields.io/pypi/wheel/pytest_pyramid.svg\n    :target: https://pypi.python.org/pypi/pytest_pyramid/\n    :alt: Wheel Status\n\n.. image:: https://img.shields.io/pypi/pyversions/pytest_pyramid.svg\n    :target: https://pypi.python.org/pypi/pytest_pyramid/\n    :alt: Supported Python Versions\n\n.. image:: https://img.shields.io/pypi/l/pytest_pyramid.svg\n    :target: https://pypi.python.org/pypi/pytest_pyramid/\n    :alt: License\n\npytest_pyramid provides basic fixtures for testing pyramid applications with pytest test suite.\n\nBy default, pytest_pyramid will create two fixtures: pyramid_config, which creates configurator based on config.ini file, and pyramid_app, which creates TestApp based on Configurator returned by pyramid_config.\n\nCommand line options\n--------------------\n\n* **--pc** - pyramid configuration file based on which pytest_pyramid will create test app\n\nUsage\n=====\n\nFor the most basic usage, pytest_pyramid provides pyramid_app and pyramid_config fixtures,\nthat can be used to test your pyramid app.\nSimply pass your pyramid config ***.ini** file to **--pc** command-line option,\nand include *pytest_app* fixture into your test suite to be able to use it for\nintegration tests.\n\nFixtures\n--------\n\npytest_pyramid provides two fixtures to be used in pytest tests:\n\n* **pyramid_config** - fixture providing pyramid's Configurator instance as\n  defined in pyramid config's file\n* **pyramid_app** - pyramid application for testing - a **webtest.app.TestApp**\n\nBoth of these fixtures depend on the Config file passed in the command line.\n\n\nFixture factories\n-----------------\n\nIf you're developing a module, package meant to extend functionalities of other\napplications, it's not necessary to create a full-blown application to test\nfunctionalities provided in packages. To do this, **pytest_pyramid** provides\nyou with fixture **pytest_pyramid.factories**.\n\nThere are two factories:\n\n* **pytest_pyramid.factories.pyramid_config** provides you with Configuration object based on either settings, config_file argument, or by --pc command-line option config file.\n* **pytest_pyramid.factories.pyramid_app** creates a **webtest.app.TestApp** based on Configurator class instance as returned from fixture passed by name to it. It also accepts additional fixtures that should be loaded before the `pyramid_app`. See the example with `postgresql` below.\n\n.. code-block:: python\n\n    from pytest_postgresql.plugin import postgresql\n    from pytest_pyramid import factories\n\n    app_config = factories.pyramid_config(config_path=\"development.ini\")\n    app_with_postgres = factories.pyramid_app(\"app_config\", \"postgresql\")\n\n    def test_pyramid_app(app_with_postgres):\n        res = app_with_postgres.get('/', status=404)\n        assert res.status_code == 404\n\n\nTODO\n----\n\n#. provide a pyramid_proc fixture that will start pyramid app process using summon_process\n\n\nTests\n-----\n\nTo run tests run this command:\n\n`pytest --pc tests/pyramid.test.ini`\n\nRelease\n=======\n\nInstall pipenv and --dev dependencies first, Then run:\n\n.. code-block::\n\n    pipenv run tbump [NEW_VERSION]\n",
    "bugtrack_url": null,
    "license": "The MIT License (MIT): http://opensource.org/licenses/MIT  Copyright (c) 2013 by pytest_pyramid authors and contributors  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "pytest_pyramid - provides fixtures for testing pyramid applications with pytest test suite",
    "version": "1.0.2",
    "split_keywords": [
        "pyramid",
        "pytest",
        "testing"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "c46d1a636742bca610512488b2d30e63",
                "sha256": "947ae8d268a2fec200f29c6da8baa4f43b50dbc0e7db10d21a1374f3b02cec51"
            },
            "downloads": -1,
            "filename": "pytest_pyramid-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c46d1a636742bca610512488b2d30e63",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 6868,
            "upload_time": "2022-12-13T14:24:57",
            "upload_time_iso_8601": "2022-12-13T14:24:57.479105Z",
            "url": "https://files.pythonhosted.org/packages/73/e5/6262523d1deaa63c80e8d24485fe7dd738c28f07facda9f9110ee301864b/pytest_pyramid-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "4d906075e46174face41c6f9bed02ede",
                "sha256": "8b3cfdabcac1b3632c91d7f9027bad1cc5acc93196d6dc43d68733f9d54a48ff"
            },
            "downloads": -1,
            "filename": "pytest_pyramid-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "4d906075e46174face41c6f9bed02ede",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 6888,
            "upload_time": "2022-12-13T14:24:59",
            "upload_time_iso_8601": "2022-12-13T14:24:59.535336Z",
            "url": "https://files.pythonhosted.org/packages/20/82/b83c3ece75f3528e69fb33bd21bd5dd63eeec38d2e0a373f778e321d2ab5/pytest_pyramid-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-13 14:24:59",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "pytest-pyramid"
}
        
Elapsed time: 0.01698s