[ckan-dev] RuntimeError on tests with latest master + New documentation for Flask migration issues

Adrià Mercader adria.mercader at okfn.org
Thu Jul 27 11:30:30 UTC 2017


Hi all,

Just a quick heads up if you are working against latest master on core
or from an extension. When running tests that involve `url_for`
directly or indirectly you might get the following exception:

> RuntimeError: Attempted to generate a URL without the application context being pushed. This has to be executed when application context is available.


This is caused by the way the new Flask based router has been
integrated in our own `url_for` helper. This article in the
documentation gives all necessary context and details on how to fix
it:

http://docs.ckan.org/en/latest/extensions/flask-migration.html#wrap-url-for-calls-in-tests-with-a-test-request-context-runtimeerror


More generally, this documentation page will be the place where we
will collect information on upgrades needed for the Flask migration
(which we are hoping to minimize). From the docs:

> This page lists changes and deprecations that both core and extensions developers should be aware of going forward, as well as common exceptions and how to fix them.


Best,

Adrià



More information about the ckan-dev mailing list