Skip to content

Commit 8043043

Browse files
committed
230426a
1 parent 9121d8d commit 8043043

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

apiflaskdemo/__init__.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ def create_app():
1515
# Se incializa la conexión entre SQLALchemy y la base de datos
1616
db.init_app(app)
1717

18-
@app.before_first_request
19-
def crea_bases():
18+
with app.app_context():
2019
'''Función encargada de verificar que exista una base de datos con
2120
las tablas de alumnos y de usuarios pobladas correctamente.
2221
En caso de no existir, es creada'''

tests/test_database.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
def base_conectada():
1212
print("Conectando a base de datos...")
1313
with app.app_context() as conectada:
14-
db.init_app(app)
14+
# db.init_app(app)
1515
yield conectada
1616

1717

tests/test_endpoints.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
@pytest.fixture
1010
def client():
1111
with app.test_client() as client:
12-
with app.app_context():
13-
db.init_app(app)
12+
#with app.app_context():
13+
# db.init_app(app)
1414
yield client
1515

1616

0 commit comments

Comments
 (0)