Skip to main content
https://raw.githubusercontent.com/fizyk/pytest_pyramid/master/logo.png

pytest_pyramid

Latest PyPI version Wheel Status Supported Python Versions 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.

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

  1. 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:

pipenv run tbump [NEW_VERSION]

Metadata

Release files for pytest-pyramid 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-pyramid 1.0.4
File Size Uploaded Provenance Actions
pytest_pyramid-1.0.4.tar.gz 8.0 kB Without provenance Details for pytest_pyramid-1.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pytest-pyramid 1.0.4
File Interpreter ABI Platform Actions
pytest_pyramid-1.0.4-py3-none-any.whl Python 3 none any Details for pytest_pyramid-1.0.4-py3-none-any.whl

Total release size: 14.9 kB

Release files / pytest_pyramid-1.0.4.tar.gz

Download URL pytest_pyramid-1.0.4.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6d9dd0d60f41f989ab3fc39878e607b371c983bb8ed728fa50605d57e03fb6d5
BLAKE2b-256 checksum
How to use checksums
e9c5d22a9c9e3d998dff531d805c65588fceca06f441690e3d6ac64c3e8def49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / pytest_pyramid-1.0.4-py3-none-any.whl

Download URL pytest_pyramid-1.0.4-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6c300ff6dac7a8e069816a4d19d4b16e738c8487a1dbab52d630cb98c6dbb9ae
BLAKE2b-256 checksum
How to use checksums
42b9460b9df2a26b53fc88c11ec18104b2d9c84ab49f43aaf1c6f7755e6706c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Security for pytest-pyramid 1.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page