attest icon indicating copy to clipboard operation
attest copied to clipboard

Access context values from following context

Open dag opened this issue 13 years ago • 1 comments

Ideally I think of contexts as independent of each other, which allows for flexible reuse, but practically it seems useful to be able to get existing test arguments in further contexts. For example Flask-Attest creates a context that returns the app; in other contexts one might need the app. There's current_app but it relies on context-locals and might not apply in other situations.

So, let the argspecs of context functions work like that of tests:

@frontend.context
def configure(app):
    app.config['FOO'] = 'BAR'
    yield
    del app.config['FOO']

dag avatar Apr 18 '11 06:04 dag

Possibly related to #93, I recall there may even have been issues with current_app; research needed for if the request context is set up correctly before other contexts, or if this is a nested() issue with Attest.

dag avatar Apr 18 '11 06:04 dag