Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-freezegun for 
openSUSE:Factory checked in at 2023-12-09 22:48:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-freezegun (Old)
 and      /work/SRC/openSUSE:Factory/.python-freezegun.new.25432 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-freezegun"

Sat Dec  9 22:48:59 2023 rev:17 rq:1131703 version:1.3.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-freezegun/python-freezegun.changes        
2023-04-22 22:01:48.525700118 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-freezegun.new.25432/python-freezegun.changes 
    2023-12-09 22:48:59.730290616 +0100
@@ -1,0 +2,8 @@
+Thu Dec  7 21:33:09 UTC 2023 - Dirk Müller <[email protected]>
+
+- update to 1.3.1:
+  * Fixed `asyncio` support to avoid `await asyncio.sleep(1)`
+    hanging forever.
+  * Added support for Python 3.12
+
+-------------------------------------------------------------------

Old:
----
  freezegun-1.2.2.tar.gz

New:
----
  freezegun-1.3.1.tar.gz

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

Other differences:
------------------
++++++ python-freezegun.spec ++++++
--- /var/tmp/diff_new_pack.cGXhCj/_old  2023-12-09 22:49:00.366313578 +0100
+++ /var/tmp/diff_new_pack.cGXhCj/_new  2023-12-09 22:49:00.370313723 +0100
@@ -16,10 +16,9 @@
 #
 
 
-%{?!python_module:%define python_module() python3-%{**}}
 %{?sle15_python_module_pythons}
 Name:           python-freezegun
-Version:        1.2.2
+Version:        1.3.1
 Release:        0
 Summary:        Mock time date for Python
 License:        Apache-2.0

++++++ freezegun-1.2.2.tar.gz -> freezegun-1.3.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-1.2.2/AUTHORS.rst 
new/freezegun-1.3.1/AUTHORS.rst
--- old/freezegun-1.2.2/AUTHORS.rst     2022-08-12 14:11:55.000000000 +0200
+++ new/freezegun-1.3.1/AUTHORS.rst     2023-12-04 20:43:28.000000000 +0100
@@ -20,3 +20,4 @@
 - `Lukasz Balcerzak <https://github.com/lukaszb>`_
 - `Hannes Ljungberg <[email protected]>`_
 - `staticdev <[email protected]>`_
+- `Marcin Sulikowski <https://github.com/marcinsulikowski>`_
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-1.2.2/CHANGELOG 
new/freezegun-1.3.1/CHANGELOG
--- old/freezegun-1.2.2/CHANGELOG       2022-08-12 14:21:48.000000000 +0200
+++ new/freezegun-1.3.1/CHANGELOG       2023-12-04 20:43:28.000000000 +0100
@@ -1,6 +1,14 @@
 Freezegun Changelog
 ===================
 
+1.3.0
+-----
+
+* Fixed `asyncio` support to avoid `await asyncio.sleep(1)` hanging forever.
+
+* Added support for Python 3.12
+
+
 1.2.2
 -----
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-1.2.2/MANIFEST.in 
new/freezegun-1.3.1/MANIFEST.in
--- old/freezegun-1.2.2/MANIFEST.in     2022-03-18 10:05:17.000000000 +0100
+++ new/freezegun-1.3.1/MANIFEST.in     2023-12-04 20:43:28.000000000 +0100
@@ -1,5 +1,6 @@
 include README.rst LICENSE AUTHORS.rst CHANGELOG pyproject.toml
 recursive-include tests *
+include requirements.txt tox.ini
 include freezegun/py.typed
 recursive-include freezegun *.pyi
 global-exclude __pycache__
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-1.2.2/PKG-INFO new/freezegun-1.3.1/PKG-INFO
--- old/freezegun-1.2.2/PKG-INFO        2022-08-12 14:23:50.008313000 +0200
+++ new/freezegun-1.3.1/PKG-INFO        2023-12-04 20:43:43.426289000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: freezegun
-Version: 1.2.2
+Version: 1.3.1
 Summary: Let your Python tests travel through time
 Home-page: https://github.com/spulec/freezegun
 Author: Steve Pulec
@@ -15,11 +15,15 @@
 Classifier: Programming Language :: Python :: 3.7
 Classifier: Programming Language :: Python :: 3.8
 Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3.10
+Classifier: Programming Language :: Python :: 3.11
+Classifier: Programming Language :: Python :: 3.12
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
-Requires-Python: >=3.6
+Requires-Python: >=3.7
 License-File: LICENSE
 License-File: AUTHORS.rst
+Requires-Dist: python-dateutil>=2.7
 
 FreezeGun: Let your Python tests travel through time
 ====================================================
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-1.2.2/freezegun/__init__.py 
new/freezegun-1.3.1/freezegun/__init__.py
--- old/freezegun-1.2.2/freezegun/__init__.py   2022-08-12 14:21:48.000000000 
+0200
+++ new/freezegun-1.3.1/freezegun/__init__.py   2023-12-04 20:43:36.000000000 
+0100
@@ -9,7 +9,7 @@
 from .config import configure
 
 __title__ = 'freezegun'
-__version__ = '1.2.2'
+__version__ = '1.3.1'
 __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-1.2.2/freezegun/api.py 
new/freezegun-1.3.1/freezegun/api.py
--- old/freezegun-1.2.2/freezegun/api.py        2022-08-12 14:11:55.000000000 
+0200
+++ new/freezegun-1.3.1/freezegun/api.py        2023-12-04 20:43:28.000000000 
+0100
@@ -1,5 +1,6 @@
 from . import config
 from ._async import wrap_coroutine
+import asyncio
 import copyreg
 import dateutil
 import datetime
@@ -407,7 +408,7 @@
 
     @classmethod
     def utcnow(cls):
-        result = cls._time_to_freeze() or real_datetime.utcnow()
+        result = cls._time_to_freeze() or 
real_datetime.now(datetime.timezone.utc)
         return datetime_to_fakedatetime(result)
 
     @staticmethod
@@ -462,14 +463,14 @@
     :returns: a naive ``datetime.datetime`` object
     """
     if time_to_freeze_str is None:
-        time_to_freeze_str = datetime.datetime.utcnow()
+        time_to_freeze_str = datetime.datetime.now(datetime.timezone.utc)
 
     if isinstance(time_to_freeze_str, datetime.datetime):
         time_to_freeze = time_to_freeze_str
     elif isinstance(time_to_freeze_str, datetime.date):
         time_to_freeze = datetime.datetime.combine(time_to_freeze_str, 
datetime.time())
     elif isinstance(time_to_freeze_str, datetime.timedelta):
-        time_to_freeze = datetime.datetime.utcnow() + time_to_freeze_str
+        time_to_freeze = datetime.datetime.now(datetime.timezone.utc) + 
time_to_freeze_str
     else:
         time_to_freeze = parser.parse(time_to_freeze_str)
 
@@ -619,7 +620,7 @@
                         continue
                     seen.add(attr)
 
-                    if not callable(attr_value) or inspect.isclass(attr_value):
+                    if not callable(attr_value) or inspect.isclass(attr_value) 
or isinstance(attr_value, staticmethod):
                         continue
 
                     try:
@@ -726,6 +727,21 @@
                         setattr(module, attribute_name, fake)
                         add_change((module, attribute_name, attribute_value))
 
+        # To avoid breaking `asyncio.sleep()`, let asyncio event loops see real
+        # monotonic time even though we've just frozen `time.monotonic()` which
+        # is normally used there. If we didn't do this, `await asyncio.sleep()`
+        # would be hanging forever breaking many tests that use `freeze_time`.
+        #
+        # Note that we cannot statically tell the class of asyncio event loops
+        # because it is not officially documented and can actually be changed
+        # at run time using `asyncio.set_event_loop_policy`. That's why we 
check
+        # the type by creating a loop here and destroying it immediately.
+        event_loop = asyncio.new_event_loop()
+        event_loop.close()
+        EventLoopClass = type(event_loop)
+        add_change((EventLoopClass, "time", EventLoopClass.time))
+        EventLoopClass.time = lambda self: real_monotonic()
+
         return freeze_factory
 
     def stop(self):
@@ -739,8 +755,8 @@
             datetime.date = real_date
             copyreg.dispatch_table.pop(real_datetime)
             copyreg.dispatch_table.pop(real_date)
-            for module, module_attribute, original_value in self.undo_changes:
-                setattr(module, module_attribute, original_value)
+            for module_or_object, attribute, original_value in 
self.undo_changes:
+                setattr(module_or_object, attribute, original_value)
             self.undo_changes = []
 
             # Restore modules loaded after start()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-1.2.2/freezegun/config.py 
new/freezegun-1.3.1/freezegun/config.py
--- old/freezegun-1.2.2/freezegun/config.py     2022-03-03 12:59:06.000000000 
+0100
+++ new/freezegun-1.3.1/freezegun/config.py     2023-12-04 20:43:28.000000000 
+0100
@@ -7,11 +7,13 @@
     'django.utils.six.moves',
     'google.gax',
     'threading',
+    'multiprocessing',
     'Queue',
     'selenium',
     '_pytest.terminal.',
     '_pytest.runner.',
     'gi',
+    'prompt_toolkit',
 ]
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-1.2.2/freezegun.egg-info/PKG-INFO 
new/freezegun-1.3.1/freezegun.egg-info/PKG-INFO
--- old/freezegun-1.2.2/freezegun.egg-info/PKG-INFO     2022-08-12 
14:23:49.000000000 +0200
+++ new/freezegun-1.3.1/freezegun.egg-info/PKG-INFO     2023-12-04 
20:43:43.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: freezegun
-Version: 1.2.2
+Version: 1.3.1
 Summary: Let your Python tests travel through time
 Home-page: https://github.com/spulec/freezegun
 Author: Steve Pulec
@@ -15,11 +15,15 @@
 Classifier: Programming Language :: Python :: 3.7
 Classifier: Programming Language :: Python :: 3.8
 Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3.10
+Classifier: Programming Language :: Python :: 3.11
+Classifier: Programming Language :: Python :: 3.12
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
-Requires-Python: >=3.6
+Requires-Python: >=3.7
 License-File: LICENSE
 License-File: AUTHORS.rst
+Requires-Dist: python-dateutil>=2.7
 
 FreezeGun: Let your Python tests travel through time
 ====================================================
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-1.2.2/freezegun.egg-info/SOURCES.txt 
new/freezegun-1.3.1/freezegun.egg-info/SOURCES.txt
--- old/freezegun-1.2.2/freezegun.egg-info/SOURCES.txt  2022-08-12 
14:23:50.000000000 +0200
+++ new/freezegun-1.3.1/freezegun.egg-info/SOURCES.txt  2023-12-04 
20:43:43.000000000 +0100
@@ -4,8 +4,10 @@
 MANIFEST.in
 README.rst
 pyproject.toml
+requirements.txt
 setup.cfg
 setup.py
+tox.ini
 freezegun/__init__.py
 freezegun/__init__.pyi
 freezegun/_async.py
@@ -18,7 +20,6 @@
 freezegun.egg-info/dependency_links.txt
 freezegun.egg-info/requires.txt
 freezegun.egg-info/top_level.txt
-tests/.DS_Store
 tests/__init__.py
 tests/another_module.py
 tests/fake_module.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-1.2.2/requirements.txt 
new/freezegun-1.3.1/requirements.txt
--- old/freezegun-1.2.2/requirements.txt        1970-01-01 01:00:00.000000000 
+0100
+++ new/freezegun-1.3.1/requirements.txt        2023-12-04 20:43:28.000000000 
+0100
@@ -0,0 +1,5 @@
+pytest
+pytest-cov
+coveralls
+python-dateutil >= 2.7
+maya; python_version < '3.12'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-1.2.2/setup.cfg 
new/freezegun-1.3.1/setup.cfg
--- old/freezegun-1.2.2/setup.cfg       2022-08-12 14:23:50.008663000 +0200
+++ new/freezegun-1.3.1/setup.cfg       2023-12-04 20:43:43.426289000 +0100
@@ -18,12 +18,15 @@
        Programming Language :: Python :: 3.7
        Programming Language :: Python :: 3.8
        Programming Language :: Python :: 3.9
+       Programming Language :: Python :: 3.10
+       Programming Language :: Python :: 3.11
+       Programming Language :: Python :: 3.12
        Programming Language :: Python :: Implementation :: CPython
        Programming Language :: Python :: Implementation :: PyPy
 
 [options]
 packages = freezegun
-python_requires = >=3.6
+python_requires = >=3.7
 install_requires = 
        python-dateutil >= 2.7
 include_package_data = true
Binary files old/freezegun-1.2.2/tests/.DS_Store and 
new/freezegun-1.3.1/tests/.DS_Store differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-1.2.2/tests/test_asyncio.py 
new/freezegun-1.3.1/tests/test_asyncio.py
--- old/freezegun-1.2.2/tests/test_asyncio.py   2022-03-03 12:59:06.000000000 
+0100
+++ new/freezegun-1.3.1/tests/test_asyncio.py   2023-12-04 20:43:28.000000000 
+0100
@@ -1,31 +1,80 @@
 import asyncio
 import datetime
-from textwrap import dedent
-from unittest import SkipTest
+import time
 
 from freezegun import freeze_time
 
 
-def test_time_freeze_coroutine():
-    if not asyncio:
-        raise SkipTest('asyncio required')
-
+def test_datetime_in_coroutine():
     @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())
+    asyncio.run(frozen_coroutine())
+
 
+def test_freezing_time_in_coroutine():
+    """Test calling freeze_time while executing asyncio loop."""
+    async def coroutine():
+        with freeze_time('1970-01-02'):
+            assert time.time() == 86400
+        with freeze_time('1970-01-03'):
+            assert time.time() == 86400 * 2
+
+    asyncio.run(coroutine())
+
+
+def test_freezing_time_before_running_coroutine():
+    """Test calling freeze_time before executing asyncio loop."""
+    async def coroutine():
+        assert time.time() == 86400
+    with freeze_time('1970-01-02'):
+        asyncio.run(coroutine())
+
+
+def test_asyncio_sleeping_not_affected_by_freeze_time():
+    """Test that asyncio.sleep() is not affected by `freeze_time`.
+
+    This test ensures that despite freezing time using `freeze_time`,
+    the asyncio event loop can see real monotonic time, which is required
+    to make things like `asyncio.sleep()` work.
+    """
+
+    async def coroutine():
+        # Sleeping with time frozen should sleep the expected duration.
+        before_sleep = time.time()
+        with freeze_time('1970-01-02'):
+            await asyncio.sleep(0.05)
+        assert 0.02 <= time.time() - before_sleep < 0.3
+
+        # Exiting `freeze_time` the time should not break asyncio sleeping.
+        before_sleep = time.time()
+        await asyncio.sleep(0.05)
+        assert 0.02 <= time.time() - before_sleep < 0.3
+
+    asyncio.run(coroutine())
+
+
+def test_asyncio_to_call_later_with_frozen_time():
+    """Test that asyncio `loop.call_later` works with frozen time."""
+    # `to_call_later` will be called by asyncio event loop and should add
+    # the Unix timestamp of 1970-01-02 00:00 to the `timestamps` list.
+    timestamps = []
+    def to_call_later():
+        timestamps.append(time.time())
+
+    async def coroutine():
+        # Schedule calling `to_call_later` in 100 ms.
+        asyncio.get_running_loop().call_later(0.1, to_call_later)
+
+        # Sleeping for 10 ms should not result in calling `to_call_later`.
+        await asyncio.sleep(0.01)
+        assert timestamps == []
+
+        # But sleeping more (150 ms in this case) should call `to_call_later`
+        # and we should see `timestamps` updated.
+        await asyncio.sleep(0.15)
+        assert timestamps == [86400]
 
-def test_time_freeze_async_def():
-    try:
-        exec('async def foo(): pass')
-    except SyntaxError:
-        raise 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())
-        '''))
+    with freeze_time('1970-01-02'):
+        asyncio.run(coroutine())
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-1.2.2/tests/test_configure.py 
new/freezegun-1.3.1/tests/test_configure.py
--- old/freezegun-1.2.2/tests/test_configure.py 2022-03-03 12:59:06.000000000 
+0100
+++ new/freezegun-1.3.1/tests/test_configure.py 2023-12-04 20:43:28.000000000 
+0100
@@ -46,11 +46,13 @@
             'django.utils.six.moves',
             'google.gax',
             'threading',
+            'multiprocessing',
             'Queue',
             'selenium',
             '_pytest.terminal.',
             '_pytest.runner.',
             'gi',
+            'prompt_toolkit',
             'tensorflow',
         ]
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/freezegun-1.2.2/tox.ini new/freezegun-1.3.1/tox.ini
--- old/freezegun-1.2.2/tox.ini 1970-01-01 01:00:00.000000000 +0100
+++ new/freezegun-1.3.1/tox.ini 2023-12-04 20:43:28.000000000 +0100
@@ -0,0 +1,16 @@
+# Tox (http://tox.testrun.org/) is a tool for running tests
+# in multiple virtualenvs. This configuration file will run the
+# test suite on all supported python versions. To use it, "pip install tox"
+# and then run "tox" from this directory.
+
+[tox]
+envlist = py37, py38, py39, py310, py311, py312, pypy3, mypy
+
+[testenv]
+commands = pytest --cov {posargs}
+deps = -rrequirements.txt
+
+[testenv:mypy]
+deps =
+    mypy
+commands = mypy freezegun

Reply via email to