I'm using Pytest to test connection to database which hangs when I run it:
def test_db():
db.create_all()
new_comment = Comments(comment='python rocks')
db.session.add(new_comment)
db.session.commit()
entry = Comments.query.all()
assert len(entry) == 1
db.drop_all()
The table is created successfully but I can't run select * from Comments;
as it hangs too. I have to kill both windows.
How can I fix this ?
question from:https://stackoverflow.com/questions/65858775/pytest-hangs-on-testing-database