diff --git a/api/src/app.py b/api/src/app.py index 84580673..0103d828 100644 --- a/api/src/app.py +++ b/api/src/app.py @@ -1,13 +1,6 @@ # 3rd parth dependencies from flask import Flask - -try: - # unit tests - from api.src.modules.core.routes import blueprint -except: - # runtime - from modules.core.routes import blueprint - +from modules.core.routes import blueprint def create_app(): app = Flask(__name__) diff --git a/api/src/modules/core/routes.py b/api/src/modules/core/routes.py index 47bacf42..e0256c1c 100644 --- a/api/src/modules/core/routes.py +++ b/api/src/modules/core/routes.py @@ -1,12 +1,5 @@ from flask import Blueprint, request - -try: - # unit tests - from api.src.modules.core import service -except: - # runtime - from modules.core import service - +from modules.core import service from deepface.commons.logger import Logger logger = Logger(module="api/src/routes.py") diff --git a/tests/test_api.py b/tests/testing_api.py similarity index 94% rename from tests/test_api.py rename to tests/testing_api.py index e2dd2e50..e5c9e953 100644 --- a/tests/test_api.py +++ b/tests/testing_api.py @@ -1,7 +1,12 @@ +import sys import unittest +from deepface.commons import constant from deepface.commons.logger import Logger -from api.src.app import create_app +# api is not available under deepface import +sys.path.insert(1, f"{constant.ROOT_DIR}/api/src") +# pylint: disable=wrong-import-order, wrong-import-position +from app import create_app logger = Logger("tests/test_api.py")