def test_logging_with_missing_file(capsys): """Assert that a message is sent to STDERR when the configuration doesn't exist.""" file_path = None setup_logging(file_path) # important to do this first captured = capsys.readouterr() assert captured.err.startswith('Unable to configure logging')
def test_logging_with_file(capsys): """Assert that logging is setup with the configuration file.""" file_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'logging.conf') setup_logging(file_path) # important to do this first captured = capsys.readouterr() assert captured.out.startswith('Configure logging, from conf')
import fnmatch import logging import papermill as pm import shutil from datetime import datetime, timedelta from email import encoders from email.mime.base import MIMEBase from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from flask import Flask, g, current_app from config import Config from legal_api.utils.logging import setup_logging from legal_api.models import db setup_logging( os.path.join(os.path.abspath(os.path.dirname(__file__)), 'logging.conf')) # important to do this first # Notebook Scheduler # --------------------------------------- # This script helps with the automated processing of Jupyter Notebooks via # papermill (https://github.com/nteract/papermill/) snapshotDir = 'snapshots' def create_app(config=Config): app = Flask(__name__) app.config.from_object(config) db.init_app(app) app.app_context().push()