# Path: oslo_utils/excutils.py
# class CausedByException(Exception):
# class save_and_reraise_exception(object):
# class exception_filter(object):
#     def __init__(self, message, cause=None):
#     def __bytes__(self):
#     def __str__(self):
#     def _get_message(self):
#     def pformat(self, indent=2, indent_text=" ", show_root_class=False):
# def raise_with_cause(exc_cls, message, *args, **kwargs):
#     def __init__(self, reraise=True, logger=None):
#     def force_reraise(self):
#     def capture(self, check=True):
#     def __enter__(self):
#     def __exit__(self, exc_type, exc_val, exc_tb):
# def forever_retry_uncaught_exceptions(*args, **kwargs):
#     def decorator(infunc):
#         def wrapper(*args, **kwargs):
#     def __init__(self, should_ignore_ex):
#     def __get__(self, obj, owner):
#     def __enter__(self):
#     def __exit__(self, exc_type, exc_val, exc_tb):
#     def __call__(self, ex):
# 
# Path: oslo_utils/timeutils.py
# _ISO8601_TIME_FORMAT_SUBSECOND = '%Y-%m-%dT%H:%M:%S.%f'
# _ISO8601_TIME_FORMAT = '%Y-%m-%dT%H:%M:%S'
# PERFECT_TIME_FORMAT = _ISO8601_TIME_FORMAT_SUBSECOND
# _MAX_DATETIME_SEC = 59
#     _STARTED = 'STARTED'
#     _STOPPED = 'STOPPED'
# def isotime(at=None, subsecond=False):
# def parse_isotime(timestr):
# def strtime(at=None, fmt=PERFECT_TIME_FORMAT):
# def parse_strtime(timestr, fmt=PERFECT_TIME_FORMAT):
# def normalize_time(timestamp):
# def is_older_than(before, seconds):
# def is_newer_than(after, seconds):
# def utcnow_ts(microsecond=False):
# def utcnow(with_timezone=False):
# def iso8601_from_timestamp(timestamp, microsecond=False):
# def set_time_override(override_time=None):
# def advance_time_delta(timedelta):
# def advance_time_seconds(seconds):
# def clear_time_override():
# def marshall_now(now=None):
# def unmarshall_time(tyme):
# def delta_seconds(before, after):
# def is_soon(dt, window):
#     def __init__(self, elapsed, length):
#     def elapsed(self):
#     def length(self):
#     def __repr__(self):
# def time_it(logger, log_level=logging.DEBUG,
#             message="It took %(seconds).02f seconds to"
#                     " run function '%(func_name)s'",
#             enabled=True, min_duration=0.01):
#     def decorator(func):
#         def wrapper(*args, **kwargs):
#     def __init__(self, duration=None):
#     def start(self):
#     def splits(self):
#     def split(self):
#     def restart(self):
#     def _delta_seconds(earlier, later):
#     def elapsed(self, maximum=None):
#     def __enter__(self):
#     def __exit__(self, type, value, traceback):
#     def leftover(self, return_none=False):
#     def expired(self):
#     def has_started(self):
#     def has_stopped(self):
#     def resume(self):
#     def stop(self):
# class Split(object):
# class StopWatch(object):


import logging
import fixtures
from unittest import mock
from oslotest import base as test_base
from oslo_utils import excutils
from oslo_utils import timeutils
        msg = 'second exception'
        try:
            try:
                raise Exception('dropped')
            except Exception:
                with excutils.save_and_reraise_exception():
                    raise Exception(msg)
        except Exception as _e:
            e = _e
        self.assertEqual(str(e), msg)
        self.assertTrue(logger.error.called)

    def test_save_and_reraise_exception_no_reraise(self):
        """Test that suppressing the reraise works."""
        try:
            raise Exception('foo')
        except Exception:
            with excutils.save_and_reraise_exception() as ctxt:
                ctxt.reraise = False

    @mock.patch('logging.getLogger')
    def test_save_and_reraise_exception_dropped_no_reraise(self,
                                                           get_logger_mock):
        logger = get_logger_mock()
        e = None
        msg = 'second exception'
        try:
            try:
                raise Exception('dropped')
            except Exception:

# Path: oslo_utils/excutils.py
# class CausedByException(Exception):
# class save_and_reraise_exception(object):
# class exception_filter(object):
#     def __init__(self, message, cause=None):
#     def __bytes__(self):
#     def __str__(self):
#     def _get_message(self):
#     def pformat(self, indent=2, indent_text=" ", show_root_class=False):
# def raise_with_cause(exc_cls, message, *args, **kwargs):
#     def __init__(self, reraise=True, logger=None):
#     def force_reraise(self):
#     def capture(self, check=True):
#     def __enter__(self):
#     def __exit__(self, exc_type, exc_val, exc_tb):
# def forever_retry_uncaught_exceptions(*args, **kwargs):
#     def decorator(infunc):
#         def wrapper(*args, **kwargs):
#     def __init__(self, should_ignore_ex):
#     def __get__(self, obj, owner):
#     def __enter__(self):
#     def __exit__(self, exc_type, exc_val, exc_tb):
#     def __call__(self, ex):
# 
# Path: oslo_utils/timeutils.py
# _ISO8601_TIME_FORMAT_SUBSECOND = '%Y-%m-%dT%H:%M:%S.%f'
# _ISO8601_TIME_FORMAT = '%Y-%m-%dT%H:%M:%S'
# PERFECT_TIME_FORMAT = _ISO8601_TIME_FORMAT_SUBSECOND
# _MAX_DATETIME_SEC = 59
#     _STARTED = 'STARTED'
#     _STOPPED = 'STOPPED'
# def isotime(at=None, subsecond=False):
# def parse_isotime(timestr):
# def strtime(at=None, fmt=PERFECT_TIME_FORMAT):
# def parse_strtime(timestr, fmt=PERFECT_TIME_FORMAT):
# def normalize_time(timestamp):
# def is_older_than(before, seconds):
# def is_newer_than(after, seconds):
# def utcnow_ts(microsecond=False):
# def utcnow(with_timezone=False):
# def iso8601_from_timestamp(timestamp, microsecond=False):
# def set_time_override(override_time=None):
# def advance_time_delta(timedelta):
# def advance_time_seconds(seconds):
# def clear_time_override():
# def marshall_now(now=None):
# def unmarshall_time(tyme):
# def delta_seconds(before, after):
# def is_soon(dt, window):
#     def __init__(self, elapsed, length):
#     def elapsed(self):
#     def length(self):
#     def __repr__(self):
# def time_it(logger, log_level=logging.DEBUG,
#             message="It took %(seconds).02f seconds to"
#                     " run function '%(func_name)s'",
#             enabled=True, min_duration=0.01):
#     def decorator(func):
#         def wrapper(*args, **kwargs):
#     def __init__(self, duration=None):
#     def start(self):
#     def splits(self):
#     def split(self):
#     def restart(self):
#     def _delta_seconds(earlier, later):
#     def elapsed(self, maximum=None):
#     def __enter__(self):
#     def __exit__(self, type, value, traceback):
#     def leftover(self, return_none=False):
#     def expired(self):
#     def has_started(self):
#     def has_stopped(self):
#     def resume(self):
#     def stop(self):
# class Split(object):
# class StopWatch(object):


# Path: oslo_utils/tests/test_excutils.py
import logging
import fixtures
from unittest import mock
from oslotest import base as test_base
from oslo_utils import excutils
from oslo_utils import timeutils

        msg = 'second exception'
        try:
            try:
                raise Exception('dropped')
            except Exception:
                with excutils.save_and_reraise_exception():
                    raise Exception(msg)
        except Exception as _e:
            e = _e
        self.assertEqual(str(e), msg)
        self.assertTrue(logger.error.called)

    def test_save_and_reraise_exception_no_reraise(self):
        """Test that suppressing the reraise works."""
        try:
            raise Exception('foo')
        except Exception:
            with excutils.save_and_reraise_exception() as ctxt:
                ctxt.reraise = False

    @mock.patch('logging.getLogger')
    def test_save_and_reraise_exception_dropped_no_reraise(self,
                                                           get_logger_mock):
        logger = get_logger_mock()
        e = None
        msg = 'second exception'
        try:
            try:
                raise Exception('dropped')
            except Exception:

                with excutils.save_and_reraise_exception(reraise=False):