Skip to content

Commit e152fa2

Browse files
committed
Add check for db setup
1 parent 7b0a310 commit e152fa2

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

hydrus/tests/conftest.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,15 @@ def init_db_for_crud_tests(drone_doc, session, engine):
218218
Drone Api test HydraDoc object.
219219
"""
220220
test_classes, test_properties = get_doc_classes_and_properties(drone_doc)
221-
create_database_tables(test_classes)
221+
try:
222+
create_database_tables(test_classes)
223+
except Exception:
224+
# catch error when the tables have been already defined.
225+
# happens when /test_socket.py is run after /test_app.py
226+
# in the same session
227+
# in that case, no need to create the tables again on the
228+
# same sqlalchemy.ext.declarative.declarative_base instance
229+
pass
222230
Base.metadata.create_all(engine)
223231

224232

0 commit comments

Comments
 (0)