You should include your route setup before, so that your registry gets populated.
I usually use pytest and its fixtures to have access to everything I need in testing, e.g. something like this:
import pytest
@pytest.fixture(scope='session')
def test_settings():
import plaster
test_settings = plaster.get_settings('testing.ini', 'app:main')
return test_settings
@pytest.fixture
def test_registry():
from pyramid import registry
reg = registry.Registry('testing')
return reg
@pytest.fixture
def test_request(test_registry):
from pyramid import request
req = request.Request({})
req.registry = test_registry
return req
@pytest.fixture
def test_config(test_settings, test_registry, test_request):
from pyramid import testing
config = testing.setUp(registry=test_registry, request=test_request, settings=test_settings)
yield config
testing.tearDown()
def test_foobar(test_config):
test_config.include('your.feature')
# assert something
test_settings fixture lives normally in the root conftest.py and the others where I need them.
cheers
Oliver