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


For the most basic usage pytest_pyramid provides a 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.


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

Both of these fixtures depend on Config file passed in 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 factories.

There are two factories:

  • pyramid_config() provides you with Configuration object based on either settings, config_file argument or by –pc command line option config file.
  • pyramid_app() creates a TestApp based on Configurator class instance as returned from fixture passed by name to it.


All relevant code is placed in factories submodule

Pytest’s fixture factories.


pyramid_app fixture factory.

Creates a TestApp instance based on.

Parameters:config_fixture_name (str) – name of a fixture creating pyramid.config.Configurator
Returns:TestApp based on pyramid’s COnfigurator object as returned from fixture passed by config_fixture_name
pytest_pyramid.factories.pyramid_config(settings=None, config_path=None)[source]

A pyramid_config fixture factory.

Used to create aditional fixtures returning pyramid’s Configurator object.

  • settings (dict) – optional parameter delivering settings for building a Configurator object.
  • config_path (str) – optional parameter delivering path to pyramid configuration file


Return type:




  • [feature] changed pyramid_config fixture scope to session.


  • [feature] support pyramid’s config inheritance with use = config:other.file.ini - Thanks Eric Hulser
  • [feature] dropped support for python 3.2, added support for python 3.4 and 3.5


  • make factories condition to check parameters against None


  • initial release
  • pyramid_config fixture factory and default fixture
  • pyramid_app fixture factory and default fixture
  • documentation


This file contains the list of people involved in the development of pytest_pyramid along its history.

  • Grzegorz Śliwiński
  • Eric Hulser


Copyright (c) 2014 by pytest_pyramid authors and contributors. See Authors

This module is part of pytest_pyramid and is released under the MIT License (MIT):