pytest-pyramid


Namepytest-pyramid JSON
Version 1.0.4 PyPI version JSON
download
home_pageNone
Summarypytest_pyramid - provides fixtures for testing pyramid applications with pytest test suite
upload_time2024-10-24 19:06:07
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
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
            .. 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": null,
    "name": "pytest-pyramid",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "pyramid, pytest, testing",
    "author": null,
    "author_email": "Grzegorz \u015aliwi\u0144ski <fizyk+pypi@fizyk.dev>",
    "download_url": "https://files.pythonhosted.org/packages/e9/c5/d22a9c9e3d998dff531d805c65588fceca06f441690e3d6ac64c3e8def49/pytest_pyramid-1.0.4.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.4",
    "project_urls": {
        "Bug Tracker": "https://github.com/fizyk/pytest_pyramid/issues",
        "Changelog": "https://github.com/fizyk/pytest_pyramid/blob/v1.0.4/CHANGES.rst",
        "Source": "https://github.com/fizyk/pytest_pyramid/"
    },
    "split_keywords": [
        "pyramid",
        " pytest",
        " testing"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "42b9460b9df2a26b53fc88c11ec18104b2d9c84ab49f43aaf1c6f7755e6706c6",
                "md5": "d4d6f4375d05928c6f2ff54e285056dd",
                "sha256": "6c300ff6dac7a8e069816a4d19d4b16e738c8487a1dbab52d630cb98c6dbb9ae"
            },
            "downloads": -1,
            "filename": "pytest_pyramid-1.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d4d6f4375d05928c6f2ff54e285056dd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 6863,
            "upload_time": "2024-10-24T19:06:06",
            "upload_time_iso_8601": "2024-10-24T19:06:06.895336Z",
            "url": "https://files.pythonhosted.org/packages/42/b9/460b9df2a26b53fc88c11ec18104b2d9c84ab49f43aaf1c6f7755e6706c6/pytest_pyramid-1.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e9c5d22a9c9e3d998dff531d805c65588fceca06f441690e3d6ac64c3e8def49",
                "md5": "60fbfca218ac572db017fd294d0a72a8",
                "sha256": "6d9dd0d60f41f989ab3fc39878e607b371c983bb8ed728fa50605d57e03fb6d5"
            },
            "downloads": -1,
            "filename": "pytest_pyramid-1.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "60fbfca218ac572db017fd294d0a72a8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 7993,
            "upload_time": "2024-10-24T19:06:07",
            "upload_time_iso_8601": "2024-10-24T19:06:07.865465Z",
            "url": "https://files.pythonhosted.org/packages/e9/c5/d22a9c9e3d998dff531d805c65588fceca06f441690e3d6ac64c3e8def49/pytest_pyramid-1.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-24 19:06:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "fizyk",
    "github_project": "pytest_pyramid",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "pytest-pyramid"
}
        
Elapsed time: 1.03921s