You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I asked this question also on stackoverflow but no replies. Maybe it has to do with the (werkzeug) test_client.
I am using pytest and want the test_client to run with different parameters. This means the fixture scope should be 'function'. With the first parameter ('de') no problems but with the next ('en' and 'es') the above error message is shown. The message comes from Flask-Babel init.py. My questions:
def create_app(project_config):
...
@babel.localeselector
def get_locale():
do something
My workaround, which appears to work fine: use a global variable that indicates if the get_locale function was decorated already. If not, I decorate it myself.
#@babel.localeselector
def get_locale():
do something
global babel_localeselector_already_registered
if not babel_localeselector_already_registered:
get_locale = babel.localeselector(get_locale)
babel_localeselector_already_registered = True
The text was updated successfully, but these errors were encountered:
I asked this question also on stackoverflow but no replies. Maybe it has to do with the (werkzeug) test_client.
I am using pytest and want the test_client to run with different parameters. This means the fixture scope should be 'function'. With the first parameter ('de') no problems but with the next ('en' and 'es') the above error message is shown. The message comes from Flask-Babel init.py. My questions:
This is the fixture:
The Flask app is nothing special:
My workaround, which appears to work fine: use a global variable that indicates if the get_locale function was decorated already. If not, I decorate it myself.
The text was updated successfully, but these errors were encountered: