Hello community,

here is the log from the commit of package python-freezegun for 
openSUSE:Factory checked in at 2018-07-17 09:37:43
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-freezegun (Old)
 and      /work/SRC/openSUSE:Factory/.python-freezegun.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-freezegun"

Tue Jul 17 09:37:43 2018 rev:3 rq:622946 version:0.3.10

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-freezegun/python-freezegun.changes        
2018-02-25 11:32:23.116354096 +0100
+++ /work/SRC/openSUSE:Factory/.python-freezegun.new/python-freezegun.changes   
2018-07-17 09:37:48.354275919 +0200
@@ -1,0 +2,8 @@
+Sun Jul 15 20:55:20 UTC 2018 - mimi...@gmail.com
+
+- update to 0.3.10 
+- add _u_p37_tests.patch
+ * Performance improvements
+ * Coroutine support
+
+-------------------------------------------------------------------

Old:
----
  freezegun-0.3.9.tar.gz

New:
----
  _u_p37_tests.patch
  freezegun-0.3.10.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-freezegun.spec ++++++
--- /var/tmp/diff_new_pack.6exQR2/_old  2018-07-17 09:37:48.766274483 +0200
+++ /var/tmp/diff_new_pack.6exQR2/_new  2018-07-17 09:37:48.766274483 +0200
@@ -16,31 +16,30 @@
 #
 
 
-%bcond_without tests
-
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
+%bcond_without tests
 Name:           python-freezegun
-Version:        0.3.9
+Version:        0.3.10
 Release:        0
-Url:            https://github.com/spulec/freezegun
 Summary:        Mock time date for Python
 License:        Apache-2.0
 Group:          Development/Languages/Python
+URL:            https://github.com/spulec/freezegun
 Source:         
https://files.pythonhosted.org/packages/source/f/freezegun/freezegun-%{version}.tar.gz
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
+Patch0:         _u_p37_tests.patch
 BuildRequires:  %{python_module devel}
 BuildRequires:  %{python_module python-dateutil > 2.0}
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  %{python_module six}
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros
+Requires:       python-python-dateutil > 2.0
+Requires:       python-six
+BuildArch:      noarch
 %if %{with tests}
 BuildRequires:  %{python_module mock}
 BuildRequires:  %{python_module nose}
 %endif
-Requires:       python-python-dateutil > 2.0
-Requires:       python-six
-BuildArch:      noarch
 %python_subpackages
 
 %description
@@ -49,6 +48,7 @@
 
 %prep
 %setup -q -n freezegun-%{version}
+%patch0 -p1
 
 %build
 %python_build
@@ -63,8 +63,8 @@
 %endif
 
 %files %{python_files}
-%defattr(-,root,root,-)
-%doc LICENSE README.rst
+%license LICENSE
+%doc README.rst
 %{python_sitelib}/*
 
 %changelog

++++++ _u_p37_tests.patch ++++++
>From 4fdad69659f15a9e62cf4f6c15c9f319276cf9b0 Mon Sep 17 00:00:00 2001
From: Jonas Obrist <jonas.obr...@hde.co.jp>
Date: Tue, 6 Mar 2018 12:21:38 +0900
Subject: [PATCH] add support for Python 3.7 uuid module changes

Python 3.7 removed uuid._uuid_generate_time. It now has
uuid._load_system_functions and uuid._generate_time_safe.
_generate_time_safe is set by calling _load_system_functions (subsequent
calls to that function are no-op). This change detects the missing
uuid._uuid_generate_time attribute and uses the new attribute/function
if they're missing.
---
 freezegun/api.py | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/freezegun/api.py b/freezegun/api.py
index eb09932..a88a392 100644
--- a/freezegun/api.py
+++ b/freezegun/api.py
@@ -27,8 +27,14 @@
 
 try:
     real_uuid_generate_time = uuid._uuid_generate_time
-except (AttributeError, ImportError):
+    uuid_generate_time_attr = '_uuid_generate_time'
+except AttributeError:
+    uuid._load_system_functions()
+    real_uuid_generate_time = uuid._generate_time_safe
+    uuid_generate_time_attr = '_generate_time_safe'
+except ImportError:
     real_uuid_generate_time = None
+    uuid_generate_time_attr = None
 
 try:
     real_uuid_create = uuid._UuidCreate
@@ -482,7 +488,8 @@ def start(self):
         time.localtime = fake_localtime
         time.gmtime = fake_gmtime
         time.strftime = fake_strftime
-        uuid._uuid_generate_time = None
+        if uuid_generate_time_attr:
+            setattr(uuid, uuid_generate_time_attr, None)
         uuid._UuidCreate = None
         uuid._last_timestamp = None
 
@@ -573,7 +580,8 @@ def stop(self):
         time.localtime = time.localtime.previous_localtime_function
         time.strftime = time.strftime.previous_strftime_function
 
-        uuid._uuid_generate_time = real_uuid_generate_time
+        if uuid_generate_time_attr:
+            setattr(uuid, uuid_generate_time_attr, real_uuid_generate_time)
         uuid._UuidCreate = real_uuid_create
         uuid._last_timestamp = None
 
++++++ freezegun-0.3.9.tar.gz -> freezegun-0.3.10.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-0.3.9/AUTHORS.rst 
new/freezegun-0.3.10/AUTHORS.rst
--- old/freezegun-0.3.9/AUTHORS.rst     2016-10-13 05:00:44.000000000 +0200
+++ new/freezegun-0.3.10/AUTHORS.rst    2018-03-06 02:15:53.000000000 +0100
@@ -13,3 +13,4 @@
 - `Zach Smith <https://github.com/zmsmith>`_
 - `Adam Johnson <https://github.com/adamchainz>`_
 - `Alex Ehlke <https://github.com/aehlke>`_
+- `James Lu <github.com/CrazyPython>`_
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-0.3.9/CHANGELOG 
new/freezegun-0.3.10/CHANGELOG
--- old/freezegun-0.3.9/CHANGELOG       2017-05-13 02:24:21.000000000 +0200
+++ new/freezegun-0.3.10/CHANGELOG      2018-03-06 03:53:53.000000000 +0100
@@ -4,6 +4,13 @@
 Latest
 ------
 
+0.3.10
+------
+
+* Performance improvements
+* Coroutine support
+* 
+
 0.3.9
 -----
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-0.3.9/PKG-INFO 
new/freezegun-0.3.10/PKG-INFO
--- old/freezegun-0.3.9/PKG-INFO        2017-05-13 02:25:54.000000000 +0200
+++ new/freezegun-0.3.10/PKG-INFO       2018-03-06 03:54:52.000000000 +0100
@@ -1,11 +1,12 @@
 Metadata-Version: 1.1
 Name: freezegun
-Version: 0.3.9
+Version: 0.3.10
 Summary: Let your Python tests travel through time
 Home-page: https://github.com/spulec/freezegun
 Author: Steve Pulec
 Author-email: spu...@gmail.com
 License: Apache 2.0
+Description-Content-Type: UNKNOWN
 Description: UNKNOWN
 Platform: UNKNOWN
 Classifier: License :: OSI Approved :: Apache Software License
@@ -14,3 +15,5 @@
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.6
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-0.3.9/README.rst 
new/freezegun-0.3.10/README.rst
--- old/freezegun-0.3.9/README.rst      2017-01-19 04:53:16.000000000 +0100
+++ new/freezegun-0.3.10/README.rst     2018-03-06 03:30:32.000000000 +0100
@@ -82,6 +82,10 @@
         # datetime.date.today() uses local time
         assert datetime.date.today() == datetime.date(2012, 1, 13)
 
+    @freeze_time("2012-01-14 03:21:34", tz_offset=-datetime.timedelta(hours=3, 
minutes=30))
+    def test_timedelta_offset():
+        assert datetime.datetime.now() == datetime.datetime(2012, 1, 13, 23, 
51, 34)
+
 Nice inputs
 ~~~~~~~~~~~
 
@@ -93,6 +97,28 @@
     def test_nice_datetime():
         assert datetime.datetime.now() == datetime.datetime(2012, 1, 14)
 
+Function and generator objects
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+FreezeGun is able to handle function and generator objects.
+
+.. code-block:: python
+
+    def test_lambda():
+        with freeze_time(lambda: datetime.datetime(2012, 1, 14)):
+            assert datetime.datetime.now() == datetime.datetime(2012, 1, 14)
+
+    def test_generator():
+        datetimes = (datetime.datetime(year, 1, 1) for year in range(2010, 
2012))
+
+        with freeze_time(datetimes):
+            assert datetime.datetime.now() == datetime.datetime(2010, 1, 1)
+
+        with freeze_time(datetimes):
+            assert datetime.datetime.now() == datetime.datetime(2011, 1, 1)
+
+        # The next call to freeze_time(datetimes) would raise a StopIteration 
exception.
+
 ``tick`` argument
 ~~~~~~~~~~~~~~~~~
 
@@ -149,6 +175,13 @@
             frozen_datetime.move_to(initial_datetime)
             assert frozen_datetime() == initial_datetime
 
+
+    @freeze_time("2012-01-14", as_arg=True)
+    def test(frozen_time):
+        assert datetime.datetime.now() == datetime.datetime(2012, 1, 14)
+        frozen_time.move_to("2014-02-12")
+        assert datetime.datetime.now() == datetime.datetime(2014, 2, 12)
+
 Parameter for ``move_to`` can be any valid ``freeze_time`` date (string, date, 
datetime).
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-0.3.9/freezegun/__init__.py 
new/freezegun-0.3.10/freezegun/__init__.py
--- old/freezegun-0.3.9/freezegun/__init__.py   2017-05-13 02:24:30.000000000 
+0200
+++ new/freezegun-0.3.10/freezegun/__init__.py  2018-03-06 03:54:23.000000000 
+0100
@@ -9,7 +9,7 @@
 from .api import freeze_time
 
 __title__ = 'freezegun'
-__version__ = '0.3.9'
+__version__ = '0.3.10'
 __author__ = 'Steve Pulec'
 __license__ = 'Apache License 2.0'
 __copyright__ = 'Copyright 2012 Steve Pulec'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-0.3.9/freezegun/_async.py 
new/freezegun-0.3.10/freezegun/_async.py
--- old/freezegun-0.3.9/freezegun/_async.py     1970-01-01 01:00:00.000000000 
+0100
+++ new/freezegun-0.3.10/freezegun/_async.py    2018-03-06 03:30:32.000000000 
+0100
@@ -0,0 +1,17 @@
+import functools
+
+import asyncio
+
+
+def wrap_coroutine(api, coroutine):
+    @functools.wraps(coroutine)
+    @asyncio.coroutine
+    def wrapper(*args, **kwargs):
+        with api as time_factory:
+            if api.as_arg:
+                result = yield from coroutine(time_factory, *args, **kwargs)
+            else:
+                result = yield from coroutine(*args, **kwargs)
+        return result
+
+    return wrapper
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-0.3.9/freezegun/api.py 
new/freezegun-0.3.10/freezegun/api.py
--- old/freezegun-0.3.9/freezegun/api.py        2017-02-09 04:47:40.000000000 
+0100
+++ new/freezegun-0.3.10/freezegun/api.py       2018-03-06 03:31:33.000000000 
+0100
@@ -1,5 +1,6 @@
 import datetime
 import functools
+import hashlib
 import inspect
 import sys
 import time
@@ -8,6 +9,8 @@
 import unittest
 import platform
 import warnings
+import types
+import numbers
 
 from dateutil import parser
 from dateutil.tz import tzlocal
@@ -18,15 +21,18 @@
 real_strftime = time.strftime
 real_date = datetime.date
 real_datetime = datetime.datetime
+real_date_objects = [real_time, real_localtime, real_gmtime, real_strftime, 
real_date, real_datetime]
+_real_time_object_ids = set(id(obj) for obj in real_date_objects)
+
 
 try:
     real_uuid_generate_time = uuid._uuid_generate_time
-except ImportError:
+except (AttributeError, ImportError):
     real_uuid_generate_time = None
 
 try:
     real_uuid_create = uuid._UuidCreate
-except ImportError:
+except (AttributeError, ImportError):
     real_uuid_create = None
 
 try:
@@ -34,6 +40,79 @@
 except ImportError:
     import copyreg
 
+try:
+    iscoroutinefunction = inspect.iscoroutinefunction
+    from freezegun._async import wrap_coroutine
+except AttributeError:
+    iscoroutinefunction = lambda x: False
+
+    def wrap_coroutine(*args):
+        raise NotImplementedError()
+
+
+# keep a cache of module attributes otherwise freezegun will need to analyze 
too many modules all the time
+# start with `None` as the sentinel value.
+# if `{}` (empty dict) was the sentinel value, there's a chance that 
`setup_modules_cache()` will be called many times
+_GLOBAL_MODULES_CACHE = None
+
+
+def _get_global_modules_cache():
+    global _GLOBAL_MODULES_CACHE
+    # the first call to this function sets up the global module cache. it's 
expected to be slower than consecutive calls
+    if _GLOBAL_MODULES_CACHE is None:
+        _GLOBAL_MODULES_CACHE = {}
+        _setup_modules_cache()
+    return _GLOBAL_MODULES_CACHE
+
+
+def _get_module_attributes(module):
+    result = []
+    try:
+        module_attributes = dir(module)
+    except TypeError:
+        return result
+    for attribute_name in module_attributes:
+        try:
+            attribute_value = getattr(module, attribute_name)
+        except (ImportError, AttributeError, TypeError):
+            # For certain libraries, this can result in ImportError(_winreg) 
or AttributeError (celery)
+            continue
+        else:
+            result.append((attribute_name, attribute_value))
+    return result
+
+
+def _setup_modules_cache():
+    for mod_name, module in list(sys.modules.items()):
+        # ignore modules from freezegun
+        if mod_name == __name__ or not mod_name or not module or not 
hasattr(module, "__name__"):
+            continue
+        _setup_module_cache(module)
+
+
+def _setup_module_cache(module):
+    global _GLOBAL_MODULES_CACHE
+    date_attrs = []
+    all_module_attributes = _get_module_attributes(module)
+    for attribute_name, attribute_value in all_module_attributes:
+        if id(attribute_value) in _real_time_object_ids:
+            date_attrs.append((attribute_name, attribute_value))
+    _GLOBAL_MODULES_CACHE[module.__name__] = 
(_get_module_attributes_hash(module), date_attrs)
+
+
+def _get_module_attributes_hash(module):
+    return '{0}-{1}'.format(id(module), 
hashlib.md5(','.join(dir(module)).encode('utf-8')).hexdigest())
+
+
+def _get_cached_module_attributes(mod_name, module):
+    global_modules_cache = _get_global_modules_cache()
+    module_hash, cached_attrs = global_modules_cache.get(mod_name, ('0', []))
+    if _get_module_attributes_hash(module) == module_hash:
+        return cached_attrs
+    else:
+        _setup_module_cache(module)
+        return _get_module_attributes(module)
+
 
 # Stolen from six
 def with_metaclass(meta, *bases):
@@ -138,7 +217,7 @@
 
     @classmethod
     def today(cls):
-        result = cls._date_to_freeze() + 
datetime.timedelta(hours=cls._tz_offset())
+        result = cls._date_to_freeze() + cls._tz_offset()
         return date_to_fakedate(result)
 
     @classmethod
@@ -190,9 +269,9 @@
     def now(cls, tz=None):
         now = cls._time_to_freeze() or real_datetime.now()
         if tz:
-            result = tz.fromutc(now.replace(tzinfo=tz)) + 
datetime.timedelta(hours=cls._tz_offset())
+            result = tz.fromutc(now.replace(tzinfo=tz)) + cls._tz_offset()
         else:
-            result = now + datetime.timedelta(hours=cls._tz_offset())
+            result = now + cls._tz_offset()
         return datetime_to_fakedatetime(result)
 
     def date(self):
@@ -270,6 +349,13 @@
     return convert_to_timezone_naive(time_to_freeze)
 
 
+def _parse_tz_offset(tz_offset):
+    if isinstance(tz_offset, datetime.timedelta):
+        return tz_offset
+    else:
+        return datetime.timedelta(hours=tz_offset)
+
+
 class TickingDateTimeFactory(object):
 
     def __init__(self, time_to_freeze, start):
@@ -289,7 +375,10 @@
         return self.time_to_freeze
 
     def tick(self, delta=datetime.timedelta(seconds=1)):
-        self.time_to_freeze += delta
+        if isinstance(delta, numbers.Real):
+            self.time_to_freeze += datetime.timedelta(seconds=delta)
+        else:
+            self.time_to_freeze += delta
 
     def move_to(self, target_datetime):
         """Moves frozen date to the given ``target_datetime``"""
@@ -300,18 +389,21 @@
 
 class _freeze_time(object):
 
-    def __init__(self, time_to_freeze_str, tz_offset, ignore, tick):
+    def __init__(self, time_to_freeze_str, tz_offset, ignore, tick, as_arg):
 
         self.time_to_freeze = _parse_time_to_freeze(time_to_freeze_str)
-        self.tz_offset = tz_offset
+        self.tz_offset = _parse_tz_offset(tz_offset)
         self.ignore = tuple(ignore)
         self.tick = tick
         self.undo_changes = []
         self.modules_at_start = set()
+        self.as_arg = as_arg
 
     def __call__(self, func):
         if inspect.isclass(func):
             return self.decorate_class(func)
+        elif iscoroutinefunction(func):
+            return self.decorate_coroutine(func)
         return self.decorate_callable(func)
 
     def decorate_class(self, klass):
@@ -375,7 +467,13 @@
 
         # Change the modules
         datetime.datetime = FakeDatetime
+        datetime.datetime.times_to_freeze.append(time_to_freeze)
+        datetime.datetime.tz_offsets.append(self.tz_offset)
+
         datetime.date = FakeDate
+        datetime.date.dates_to_freeze.append(time_to_freeze)
+        datetime.date.tz_offsets.append(self.tz_offset)
+
         fake_time = FakeTime(time_to_freeze, time.time)
         fake_localtime = FakeLocalTime(time_to_freeze, time.localtime)
         fake_gmtime = FakeGMTTime(time_to_freeze, time.gmtime)
@@ -386,6 +484,7 @@
         time.strftime = fake_strftime
         uuid._uuid_generate_time = None
         uuid._UuidCreate = None
+        uuid._last_timestamp = None
 
         copyreg.dispatch_table[real_datetime] = pickle_fake_datetime
         copyreg.dispatch_table[real_date] = pickle_fake_date
@@ -399,7 +498,6 @@
             ('real_strftime', real_strftime, 'FakeStrfTime', fake_strftime),
             ('real_time', real_time, 'FakeTime', fake_time),
         ]
-        real_names = tuple(real_name for real_name, real, fake_name, fake in 
to_patch)
         self.fake_names = tuple(fake_name for real_name, real, fake_name, fake 
in to_patch)
         self.reals = dict((id(fake), real) for real_name, real, fake_name, 
fake in to_patch)
         fakes = dict((id(real), fake) for real_name, real, fake_name, fake in 
to_patch)
@@ -412,30 +510,19 @@
             warnings.filterwarnings('ignore')
 
             for mod_name, module in list(sys.modules.items()):
-                if mod_name is None or module is None:
+                if mod_name is None or module is None or mod_name == __name__:
                     continue
-                elif mod_name.startswith(self.ignore):
+                elif mod_name.startswith(self.ignore) or 
mod_name.endswith('.six.moves'):
                     continue
                 elif (not hasattr(module, "__name__") or module.__name__ in 
('datetime', 'time')):
                     continue
-                for module_attribute in dir(module):
-                    if module_attribute in real_names:
-                        continue
-                    try:
-                        attribute_value = getattr(module, module_attribute)
-                    except (ImportError, AttributeError, TypeError):
-                        # For certain libraries, this can result in 
ImportError(_winreg) or AttributeError (celery)
-                        continue
+
+                module_attrs = _get_cached_module_attributes(mod_name, module)
+                for attribute_name, attribute_value in module_attrs:
                     fake = fakes.get(id(attribute_value))
                     if fake:
-                        setattr(module, module_attribute, fake)
-                        add_change((module, module_attribute, attribute_value))
-
-        datetime.datetime.times_to_freeze.append(time_to_freeze)
-        datetime.datetime.tz_offsets.append(self.tz_offset)
-
-        datetime.date.dates_to_freeze.append(time_to_freeze)
-        datetime.date.tz_offsets.append(self.tz_offset)
+                        setattr(module, attribute_name, fake)
+                        add_change((module, attribute_name, attribute_value))
 
         return time_to_freeze
 
@@ -463,7 +550,7 @@
                     module = sys.modules.get(mod_name, None)
                     if mod_name is None or module is None:
                         continue
-                    elif mod_name.startswith(self.ignore):
+                    elif mod_name.startswith(self.ignore) or 
mod_name.endswith('.six.moves'):
                         continue
                     elif (not hasattr(module, "__name__") or module.__name__ 
in ('datetime', 'time')):
                         continue
@@ -488,11 +575,18 @@
 
         uuid._uuid_generate_time = real_uuid_generate_time
         uuid._UuidCreate = real_uuid_create
+        uuid._last_timestamp = None
+
+    def decorate_coroutine(self, coroutine):
+        return wrap_coroutine(self, coroutine)
 
     def decorate_callable(self, func):
         def wrapper(*args, **kwargs):
-            with self:
-                result = func(*args, **kwargs)
+            with self as time_factory:
+                if self.as_arg:
+                    result = func(time_factory, *args, **kwargs)
+                else:
+                    result = func(*args, **kwargs)
             return result
         functools.update_wrapper(wrapper, func)
 
@@ -503,26 +597,34 @@
         return wrapper
 
 
-def freeze_time(time_to_freeze=None, tz_offset=0, ignore=None, tick=False):
+def freeze_time(time_to_freeze=None, tz_offset=0, ignore=None, tick=False, 
as_arg=False):
     # Python3 doesn't have basestring, but it does have str.
     try:
         string_type = basestring
     except NameError:
         string_type = str
 
-    if not isinstance(time_to_freeze, (type(None), string_type, 
datetime.date)):
-        raise TypeError(('freeze_time() expected None, a string, date 
instance, or '
-                         'datetime instance, but got type 
{0}.').format(type(time_to_freeze)))
+    if not isinstance(time_to_freeze, (type(None), string_type, datetime.date,
+        types.FunctionType, types.GeneratorType)):
+        raise TypeError(('freeze_time() expected None, a string, date 
instance, datetime '
+                         'instance, function or a generator, but got type 
{0}.').format(type(time_to_freeze)))
     if tick and not _is_cpython:
         raise SystemError('Calling freeze_time with tick=True is only 
compatible with CPython')
 
+    if isinstance(time_to_freeze, types.FunctionType):
+        return freeze_time(time_to_freeze(), tz_offset, ignore, tick)
+
+    if isinstance(time_to_freeze, types.GeneratorType):
+        return freeze_time(next(time_to_freeze), tz_offset, ignore, tick)
+
     if ignore is None:
         ignore = []
     ignore.append('six.moves')
     ignore.append('django.utils.six.moves')
+    ignore.append('google.gax')
     ignore.append('threading')
     ignore.append('Queue')
-    return _freeze_time(time_to_freeze, tz_offset, ignore, tick)
+    return _freeze_time(time_to_freeze, tz_offset, ignore, tick, as_arg)
 
 
 # Setup adapters for sqlite
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-0.3.9/freezegun.egg-info/PKG-INFO 
new/freezegun-0.3.10/freezegun.egg-info/PKG-INFO
--- old/freezegun-0.3.9/freezegun.egg-info/PKG-INFO     2017-05-13 
02:25:54.000000000 +0200
+++ new/freezegun-0.3.10/freezegun.egg-info/PKG-INFO    2018-03-06 
03:54:52.000000000 +0100
@@ -1,11 +1,12 @@
 Metadata-Version: 1.1
 Name: freezegun
-Version: 0.3.9
+Version: 0.3.10
 Summary: Let your Python tests travel through time
 Home-page: https://github.com/spulec/freezegun
 Author: Steve Pulec
 Author-email: spu...@gmail.com
 License: Apache 2.0
+Description-Content-Type: UNKNOWN
 Description: UNKNOWN
 Platform: UNKNOWN
 Classifier: License :: OSI Approved :: Apache Software License
@@ -14,3 +15,5 @@
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.6
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-0.3.9/freezegun.egg-info/SOURCES.txt 
new/freezegun-0.3.10/freezegun.egg-info/SOURCES.txt
--- old/freezegun-0.3.9/freezegun.egg-info/SOURCES.txt  2017-05-13 
02:25:54.000000000 +0200
+++ new/freezegun-0.3.10/freezegun.egg-info/SOURCES.txt 2018-03-06 
03:54:52.000000000 +0100
@@ -6,6 +6,7 @@
 setup.cfg
 setup.py
 freezegun/__init__.py
+freezegun/_async.py
 freezegun/api.py
 freezegun.egg-info/PKG-INFO
 freezegun.egg-info/SOURCES.txt
@@ -15,6 +16,7 @@
 tests/__init__.py
 tests/another_module.py
 tests/fake_module.py
+tests/test_asyncio.py
 tests/test_class_import.py
 tests/test_datetimes.py
 tests/test_import_alias.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-0.3.9/freezegun.egg-info/requires.txt 
new/freezegun-0.3.10/freezegun.egg-info/requires.txt
--- old/freezegun-0.3.9/freezegun.egg-info/requires.txt 2017-05-13 
02:25:54.000000000 +0200
+++ new/freezegun-0.3.10/freezegun.egg-info/requires.txt        2018-03-06 
03:54:52.000000000 +0100
@@ -1,2 +1,2 @@
 six
-python-dateutil>=1.0, != 2.0
+python-dateutil!=2.0,>=1.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-0.3.9/setup.cfg 
new/freezegun-0.3.10/setup.cfg
--- old/freezegun-0.3.9/setup.cfg       2017-05-13 02:25:54.000000000 +0200
+++ new/freezegun-0.3.10/setup.cfg      2018-03-06 03:54:52.000000000 +0100
@@ -10,5 +10,4 @@
 [egg_info]
 tag_build = 
 tag_date = 0
-tag_svn_revision = 0
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-0.3.9/setup.py 
new/freezegun-0.3.10/setup.py
--- old/freezegun-0.3.9/setup.py        2017-05-13 02:25:46.000000000 +0200
+++ new/freezegun-0.3.10/setup.py       2018-03-06 03:54:04.000000000 +0100
@@ -11,10 +11,14 @@
     # Py3k
     requires += ['python-dateutil>=2.0']
 
+with open('README.rst') as f:
+    readme = f.read()
+
 setup(
     name='freezegun',
-    version='0.3.9',
+    version='0.3.10',
     description='Let your Python tests travel through time',
+    long_desciption=readme,
     author='Steve Pulec',
     author_email='spu...@gmail.com',
     url='https://github.com/spulec/freezegun',
@@ -29,5 +33,7 @@
         'Programming Language :: Python :: 2.7',
         'Programming Language :: Python :: 3',
         'Programming Language :: Python :: 3.3',
+        'Programming Language :: Python :: 3.4',
+        'Programming Language :: Python :: 3.6',
     ],
 )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-0.3.9/tests/test_asyncio.py 
new/freezegun-0.3.10/tests/test_asyncio.py
--- old/freezegun-0.3.9/tests/test_asyncio.py   1970-01-01 01:00:00.000000000 
+0100
+++ new/freezegun-0.3.10/tests/test_asyncio.py  2018-03-06 03:30:32.000000000 
+0100
@@ -0,0 +1,36 @@
+import datetime
+from textwrap import dedent
+
+from nose.plugins import skip
+
+from freezegun import freeze_time
+
+try:
+    import asyncio
+except ImportError:
+    asyncio = False
+
+
+def test_time_freeze_coroutine():
+    if not asyncio:
+        raise skip.SkipTest('asyncio required')
+    @asyncio.coroutine
+    @freeze_time('1970-01-01')
+    def frozen_coroutine():
+        assert datetime.date.today() == datetime.date(1970, 1, 1)
+
+    asyncio.get_event_loop().run_until_complete(frozen_coroutine())
+
+
+def test_time_freeze_async_def():
+    try:
+        exec('async def foo(): pass')
+    except SyntaxError:
+        raise skip.SkipTest('async def not supported')
+    else:
+        exec(dedent('''
+        @freeze_time('1970-01-01')
+        async def frozen_coroutine():
+            assert datetime.date.today() == datetime.date(1970, 1, 1)
+        asyncio.get_event_loop().run_until_complete(frozen_coroutine())
+        '''))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-0.3.9/tests/test_datetimes.py 
new/freezegun-0.3.10/tests/test_datetimes.py
--- old/freezegun-0.3.9/tests/test_datetimes.py 2016-11-06 15:56:38.000000000 
+0100
+++ new/freezegun-0.3.10/tests/test_datetimes.py        2018-03-06 
03:30:32.000000000 +0100
@@ -5,6 +5,7 @@
 import sys
 
 from nose.plugins import skip
+from nose.tools import assert_raises
 from tests import utils
 
 from freezegun import freeze_time
@@ -76,6 +77,15 @@
     freezer.stop()
 
 
+def test_timedelta_tz_offset():
+    freezer = freeze_time("2012-01-14 03:21:34",
+                          tz_offset=-datetime.timedelta(hours=3, minutes=30))
+    freezer.start()
+    assert datetime.datetime.now() == datetime.datetime(2012, 1, 13, 23, 51, 
34)
+    assert datetime.datetime.utcnow() == datetime.datetime(2012, 1, 14, 3, 21, 
34)
+    freezer.stop()
+
+
 def test_tz_offset_with_today():
     freezer = freeze_time("2012-01-14", tz_offset=-4)
     freezer.start()
@@ -137,6 +147,21 @@
         assert frozen_datetime() == initial_datetime
 
 
+def test_manual_increment_seconds():
+    initial_datetime = datetime.datetime(year=1, month=7, day=12,
+                                         hour=15, minute=6, second=3)
+    with freeze_time(initial_datetime) as frozen_datetime:
+        assert frozen_datetime() == initial_datetime
+
+        frozen_datetime.tick()
+        initial_datetime += datetime.timedelta(seconds=1)
+        assert frozen_datetime() == initial_datetime
+
+        frozen_datetime.tick(10)
+        initial_datetime += datetime.timedelta(seconds=10)
+        assert frozen_datetime() == initial_datetime
+
+
 def test_move_to():
     initial_datetime = datetime.datetime(year=1, month=7, day=12,
                                         hour=15, minute=6, second=3)
@@ -248,6 +273,35 @@
     assert datetime_freezer.time_to_freeze == regular_freezer.time_to_freeze
 
 
+def test_function_object():
+    frozen_datetime = datetime.datetime(year=2012, month=11, day=10,
+                                        hour=4, minute=15, second=30)
+    def function(): return frozen_datetime
+
+    with freeze_time(function):
+        assert frozen_datetime == datetime.datetime.now()
+
+
+def test_lambda_object():
+    frozen_datetime = datetime.datetime(year=2012, month=11, day=10,
+                                        hour=4, minute=15, second=30)
+    with freeze_time(lambda: frozen_datetime):
+        assert frozen_datetime == datetime.datetime.now()
+
+
+def test_generator_object():
+    frozen_datetimes = (datetime.datetime(year=y, month=1, day=1)
+        for y in range(2010, 2012))
+
+    with freeze_time(frozen_datetimes):
+        assert datetime.datetime(2010, 1, 1) == datetime.datetime.now()
+
+    with freeze_time(frozen_datetimes):
+        assert datetime.datetime(2011, 1, 1) == datetime.datetime.now()
+
+    assert_raises(StopIteration, freeze_time, frozen_datetimes)
+
+
 def test_old_datetime_object():
     frozen_datetime = datetime.datetime(year=1, month=7, day=12,
                                         hour=15, minute=6, second=3)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-0.3.9/tests/test_uuid.py 
new/freezegun-0.3.10/tests/test_uuid.py
--- old/freezegun-0.3.9/tests/test_uuid.py      2017-02-09 04:47:40.000000000 
+0100
+++ new/freezegun-0.3.10/tests/test_uuid.py     2018-03-06 03:30:32.000000000 
+0100
@@ -1,24 +1,46 @@
+from __future__ import print_function, absolute_import, unicode_literals
 import datetime
 import uuid
 
+from nose.tools import assert_equal
+
 from freezegun import freeze_time
 
 
 def time_from_uuid(value):
-    """Converts an UUID(1) to it's datetime value"""
+    """
+    Converts an UUID(1) to it's datetime value
+    """
     uvalue = value if isinstance(value, uuid.UUID) else uuid.UUID(value)
-
     assert uvalue.version == 1
-
     return (datetime.datetime(1582, 10, 15) +
             datetime.timedelta(microseconds=uvalue.time // 10))
 
-def test_uuid1():
-    # Test that the uuid.uuid1() methods generate a value from the freezed date
-    # This was not always the case as python is
-    # using the system's one if available through ctypes
-    target = datetime.datetime(2017, 2, 6, 14, 8, 21)
-
-    with freeze_time(target):
-        assert time_from_uuid(uuid.uuid1()) == target
 
+def test_uuid1_future():
+    """
+    Test that we can go back in time after setting a future date.
+    Normally UUID1 would disallow this, since it keeps track of
+    the _last_timestamp, but we override that now.
+    """
+    future_target = datetime.datetime(2056, 2, 6, 14, 3, 21)
+    with freeze_time(future_target):
+        assert_equal(time_from_uuid(uuid.uuid1()), future_target)
+
+    past_target = datetime.datetime(1978, 7, 6, 23, 6, 31)
+    with freeze_time(past_target):
+        assert_equal(time_from_uuid(uuid.uuid1()), past_target)
+
+
+def test_uuid1_past():
+    """
+    Test that we can go forward in time after setting some time in the past.
+    This is simply the opposite of test_uuid1_future()
+    """
+    past_target = datetime.datetime(1978, 7, 6, 23, 6, 31)
+    with freeze_time(past_target):
+        assert_equal(time_from_uuid(uuid.uuid1()), past_target)
+
+    future_target = datetime.datetime(2056, 2, 6, 14, 3, 21)
+    with freeze_time(future_target):
+        assert_equal(time_from_uuid(uuid.uuid1()), future_target)


Reply via email to