# Path: oslo_utils/fixture.py
# class TimeFixture(fixtures.Fixture):
# class _UUIDSentinels(object):
#     def __init__(self, override_time=None):
#     def setUp(self):
#     def advance_time_delta(self, timedelta):
#     def advance_time_seconds(self, seconds):
#     def __init__(self, is_dashed=True):
#     def __getattr__(self, name):
# 
# Path: oslo_utils/fixture.py
# class TimeFixture(fixtures.Fixture):
# class _UUIDSentinels(object):
#     def __init__(self, override_time=None):
#     def setUp(self):
#     def advance_time_delta(self, timedelta):
#     def advance_time_seconds(self, seconds):
#     def __init__(self, is_dashed=True):
#     def __getattr__(self, name):
# 
# Path: oslo_utils/fixture.py
# class TimeFixture(fixtures.Fixture):
# class _UUIDSentinels(object):
#     def __init__(self, override_time=None):
#     def setUp(self):
#     def advance_time_delta(self, timedelta):
#     def advance_time_seconds(self, seconds):
#     def __init__(self, is_dashed=True):
#     def __getattr__(self, name):
# 
# 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/uuidutils.py
# def generate_uuid(dashed=True):
# def _format_uuid_string(string):
# def is_uuid_like(val):


import datetime
from oslotest import base as test_base
from oslo_utils import fixture
from oslo_utils.fixture import keystoneidsentinel as keystids
from oslo_utils.fixture import uuidsentinel as uuids
from oslo_utils import timeutils
from oslo_utils import uuidutils
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.





class TimeFixtureTest(test_base.BaseTestCase):

    def test_set_time_override_using_default(self):
        # When the fixture is used with its default constructor, the
        # override_time is set to the current timestamp.
        # Also, when the fixture is cleaned up, the override_time is reset.

        self.assertIsNone(timeutils.utcnow.override_time)
        with fixture.TimeFixture():
            self.assertIsNotNone(timeutils.utcnow.override_time)
        self.assertIsNone(timeutils.utcnow.override_time)

    def test_set_time_override(self):
        # When the fixture is used to set a time, utcnow returns that time.

        new_time = datetime.datetime(2015, 1, 2, 3, 4, 6, 7)
        self.useFixture(fixture.TimeFixture(new_time))
        self.assertEqual(new_time, timeutils.utcnow())
        # Call again to make sure it keeps returning the same time.

# Path: oslo_utils/fixture.py
# class TimeFixture(fixtures.Fixture):
# class _UUIDSentinels(object):
#     def __init__(self, override_time=None):
#     def setUp(self):
#     def advance_time_delta(self, timedelta):
#     def advance_time_seconds(self, seconds):
#     def __init__(self, is_dashed=True):
#     def __getattr__(self, name):
# 
# Path: oslo_utils/fixture.py
# class TimeFixture(fixtures.Fixture):
# class _UUIDSentinels(object):
#     def __init__(self, override_time=None):
#     def setUp(self):
#     def advance_time_delta(self, timedelta):
#     def advance_time_seconds(self, seconds):
#     def __init__(self, is_dashed=True):
#     def __getattr__(self, name):
# 
# Path: oslo_utils/fixture.py
# class TimeFixture(fixtures.Fixture):
# class _UUIDSentinels(object):
#     def __init__(self, override_time=None):
#     def setUp(self):
#     def advance_time_delta(self, timedelta):
#     def advance_time_seconds(self, seconds):
#     def __init__(self, is_dashed=True):
#     def __getattr__(self, name):
# 
# 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/uuidutils.py
# def generate_uuid(dashed=True):
# def _format_uuid_string(string):
# def is_uuid_like(val):


# Path: oslo_utils/tests/test_fixture.py
import datetime
from oslotest import base as test_base
from oslo_utils import fixture
from oslo_utils.fixture import keystoneidsentinel as keystids
from oslo_utils.fixture import uuidsentinel as uuids
from oslo_utils import timeutils
from oslo_utils import uuidutils

#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.





class TimeFixtureTest(test_base.BaseTestCase):

    def test_set_time_override_using_default(self):
        # When the fixture is used with its default constructor, the
        # override_time is set to the current timestamp.
        # Also, when the fixture is cleaned up, the override_time is reset.

        self.assertIsNone(timeutils.utcnow.override_time)
        with fixture.TimeFixture():
            self.assertIsNotNone(timeutils.utcnow.override_time)
        self.assertIsNone(timeutils.utcnow.override_time)

    def test_set_time_override(self):
        # When the fixture is used to set a time, utcnow returns that time.

        new_time = datetime.datetime(2015, 1, 2, 3, 4, 6, 7)
        self.useFixture(fixture.TimeFixture(new_time))
        self.assertEqual(new_time, timeutils.utcnow())
        # Call again to make sure it keeps returning the same time.

        self.assertEqual(new_time, timeutils.utcnow())