def test_logger_log(caplog):
    logger = get_logger(__name__)
    logger.error("This is an error")
    logger.warning("This is a warning")
    logger.info("This is an informational message")
    logger.debug("This is a debug message")

    assert "This is an error" in caplog.text
    assert "This is a warning" in caplog.text
    assert "This is an informational message" not in caplog.text
    assert "This is a debug message" not in caplog.text
Exemplo n.º 2
0
#                                                                                                                     #
#  or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES  #
#  OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions     #
#  and limitations under the License.                                                                                 #
# #####################################################################################################################

from functools import wraps
from os import environ

import boto3
from botocore.config import Config
from botocore.stub import Stubber

from shared.logging import get_logger

logger = get_logger(__name__)

SOLUTION_ID = "SOL0123"
CLIENT_CONFIG = Config(retries={"max_attempts": 10, "mode": "standard"})

# declaring these global makes initialization/ performance a bit better if generating many forecasts
_helpers_service_clients = dict()


class ResourcePending(Exception):
    pass


class ResourceFailed(Exception):
    pass
def test_get_logger():
    logger = get_logger(__name__)
    assert logger.level == logging.WARNING