Skip to content

App hangs on test #409

Answered by skwzrd
skwzrd asked this question in Q&A
Discussion options

You must be logged in to vote

Databases were still connected... I found out which database it was by using something like

import sys
import traceback

for thread in threading.enumerate():
    if thread is not threading.main_thread():
        print(f'{thread.name=}')
        traceback.print_stack(sys._current_frames()[thread.ident])

I created this decorator for the test functions.

def close_all_dbs(func):
    @wraps(func)
    def wrapper(*args, **kwargs):
        func(*args, **kwargs)
        asyncio.run(db.pool_manager.close_pools())
        asyncio.run(db.pool_manager.close_pools())
    return wrapper

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by skwzrd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant