Commit ace5bb9d authored by Hermann Krumrey's avatar Hermann Krumrey

Run background tasks in app context

parent faadacc9
Pipeline #1839 passed with stages
in 3 minutes and 51 seconds
......@@ -52,7 +52,6 @@ class TestApiKey(_TestFramework):
"creation_time": api_key.creation_time
}
)
self.assertEqual(user.__json__(True), user.__json__(False))
def test_string_representation(self):
"""
......@@ -65,7 +64,7 @@ class TestApiKey(_TestFramework):
data.pop("id")
self.assertEqual(
str(api_key),
"ApiKey:{} <{}>".format(user.id, data)
"ApiKey:{} <{}>".format(api_key.id, data)
)
def test_repr(self):
......
......@@ -33,7 +33,8 @@ if __name__ == '__main__':
:return: None
"""
try:
function()
with app.app_context():
function()
except Exception as e:
app.logger.error("Encountered exception in background thread "
"{} - {}".format(name, e))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment