def test_app_factory(global_config, **settings): """ This function returns a WSGI application. It is usually called by the PasteDeploy framework during ``paster serve``. """ queue = Queue() zcml_file = settings.get('configure_zcml', 'tests.zcml') config = testing.setUp() config.setup_registry(root_factory=NamespaceContext.get_factory(queue), settings=settings) config.include(pyramid_zcml) config.load_zcml(zcml_file) lib_files_dir = os.path.join(os.path.abspath(__file__), '..', 'static') jqtest_dir = os.path.join(os.path.dirname(__file__), '..', 'static/jquery-tests') lib_files = []#['/static/jquery.min.js', '/static/testinit.js', '/static/testrunner.js'] config.registry.registerUtility(queue, ISnottyQueue) if settings.get('debug', None): try: from werkzeug.debug import DebuggedApplication return DebuggedApplication(config.make_wsgi_app(), True) except ImportError: pass spawn_n(read_q, queue) return config.make_wsgi_app()
def test_namespacecontext_get_factory(): QUEUE = object() factory = NamespaceContext.get_factory(QUEUE) ns = factory(None) # factory take a 'request' arg which isn't used subns = ns['one']['two'] ok_(subns.queue is QUEUE)