which in most cases works as expected, however it seems inconsistent with all other calls as one has to provide extra argument just in case, someone would be willing to define app via a reference to config file.
Proposed resolution
Keep default value of relative_to as None, but if to be used (before the call to loadapp, check if it is None and if so, set it to ".".
Existing line:
app = loadapp(app, relative_to=relative_to)
could change to:
app = loadapp(app, relative_to=relative_to or ".")
WebTest works well with WSGI applications as well as urls provided via environment variable
WEBTEST_TARGET_URL
.WebTest.__init__
provides argumentrelative_to
with default valueNone
.Typical creation of TestApp instance is:
There are multiple options for providing argument
app
:config:local.ini#test
orconfig:local.ini
(value being the same as when used aspserve
command line argument.Failures when using reference to config file
When using the reference to config file (either as direct value or indirectly via environment variable
WEBTEST_TARGET_URL
), the instantiation fails at http://webtest.pythonpaste.org/en/latest/api.html#webtest.app.TestApp as therelative_to
is None.Quick fix is to
which in most cases works as expected, however it seems inconsistent with all other calls as one has to provide extra argument just in case, someone would be willing to define
app
via a reference to config file.Proposed resolution
Keep default value of
relative_to
asNone
, but if to be used (before the call toloadapp
, check if it is None and if so, set it to"."
.Existing line:
could change to: