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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_pyramid-1.1.1.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_pyramid-1.1.1-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file pytest_pyramid-1.1.1.tar.gz.

File metadata

  • Download URL: pytest_pyramid-1.1.1.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pytest_pyramid-1.1.1.tar.gz
Algorithm Hash digest
SHA256 f24c0bcce66aacf2754fc4409560c07af7f034e07384a90f814eb61583316fe3
MD5 420550247d7785f87c04cf974f6fe76f
BLAKE2b-256 85265c51be902532364267832ec215e04b52622e3bbbd0c8f4338b55de1a97c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_pyramid-1.1.1.tar.gz:

Publisher: pypi.yml on fizyk/pytest_pyramid

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_pyramid-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: pytest_pyramid-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pytest_pyramid-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b42d958598652a1c94d7b545b6b04b1fdf4bd57cedc2f5b422c6b4cb6c65d068
MD5 b6297a36060c2939c161557a1eee8eef
BLAKE2b-256 71e30536862fb97756d470ab7e3892f0a62d3ac610eebf3085ab9d054c8e6b98

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_pyramid-1.1.1-py3-none-any.whl:

Publisher: pypi.yml on fizyk/pytest_pyramid

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 files

1.1.0

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

3 files

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