Modif log en mode TEST

This commit is contained in:
Emmanuel Viennet 2023-01-11 16:39:58 -03:00
parent 8ca59fe226
commit 48e40e79ba
2 changed files with 2 additions and 4 deletions

View File

@ -502,12 +502,10 @@ def clear_scodoc_cache():
# --------- Logging # --------- Logging
def log(msg: str, silent_test=True): def log(msg: str):
"""log a message. """log a message.
If Flask app, use configured logger, else stderr. If Flask app, use configured logger, else stderr.
""" """
if silent_test and current_app and current_app.config["TESTING"]:
return
try: try:
dept = getattr(g, "scodoc_dept", "") dept = getattr(g, "scodoc_dept", "")
msg = f" ({dept}) {msg}" msg = f" ({dept}) {msg}"

View File

@ -72,7 +72,7 @@ class DevConfig(Config):
class TestConfig(DevConfig): class TestConfig(DevConfig):
"Pour les tests unitaires" "Pour les tests unitaires"
TESTING = True TESTING = True
DEBUG = True DEBUG = False
SQLALCHEMY_DATABASE_URI = ( SQLALCHEMY_DATABASE_URI = (
os.environ.get("SCODOC_TEST_DATABASE_URI") or "postgresql:///SCODOC_TEST" os.environ.get("SCODOC_TEST_DATABASE_URI") or "postgresql:///SCODOC_TEST"
) )