pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/time/py-time-machine
Module Name: pkgsrc
Committed By: adam
Date: Mon Dec 1 13:25:48 UTC 2025
Modified Files:
pkgsrc/time/py-time-machine: Makefile distinfo
Log Message:
py-time-machine: updated to 3.1.0
3.1.0 (2025-11-21)
Optimize patching of uuid module. By avoiding using unittest.mock, this small overhead from starting time_machine.travel() has been reduced about 20x, from ~600ns to ~30ns by one benchmark.
3.0.0 (2025-11-18)
Remove mocking of time.monotonic() and time.monotonic_ns().
This mocking caused too many issues, such as causing freezes in asyncio event loops (Issue 387), preventing pytest-durations from timing tests correctly (Issue 505), and triggering timeouts in
psycopg (Issue 509). The root cause here is that mocking the monotonic clock breaks its contract, allowing it to move backwards when it’s meant to only move forwards.
As an alternative, use unittest.mock to mock the monotonic function for the specific tested modules that need it. That means that your code should import monotonic() or monotonic_ns() directly, so
that your tests can mock it in those places only. For example, if your system under test looks like:
# example.py
from time import monotonic
def measurement():
start = monotonic()
...
end = monotonic()
return end - start
…then your tests can mock monotonic() like this:
from unittest import TestCase, mock
import example
class MeasurementTests(TestCase):
def test_success(self):
with mock.patch.object(example, "monotonic", side_effect=[0.0, 1.23]):
result = example.measurement()
assert result == 1.23
Parse str destinations with datetime.fromisoformat() first, before falling back to dateutil if installed. datetime.fromisoformat() can parse most valid ISO 8601 formats, with better performance and
no extra dependencies.
Make the dependency on dateutil optional. To include dateutil support, install with the dateutil extra:
python -m pip install time-machine[dateutil]
Beware that some of the formats that dateutil parses are ambiguous and may lead to unexpected results.
Rename the Coordinates class to Traveller, to match the recommended context manager variable name.
Drop Python 3.9 support.
Make the escape_hatch functions raise ValueError when called outside of time-travelling, rather than triggering segmentation faults.
To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 pkgsrc/time/py-time-machine/Makefile
cvs rdiff -u -r1.10 -r1.11 pkgsrc/time/py-time-machine/distinfo
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/time/py-time-machine/Makefile
diff -u pkgsrc/time/py-time-machine/Makefile:1.12 pkgsrc/time/py-time-machine/Makefile:1.13
--- pkgsrc/time/py-time-machine/Makefile:1.12 Thu Aug 21 07:11:27 2025
+++ pkgsrc/time/py-time-machine/Makefile Mon Dec 1 13:25:47 2025
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.12 2025/08/21 07:11:27 adam Exp $
+# $NetBSD: Makefile,v 1.13 2025/12/01 13:25:47 adam Exp $
-DISTNAME= time_machine-2.19.0
+DISTNAME= time_machine-3.1.0
PKGNAME= ${PYPKGPREFIX}-${DISTNAME:S/_/-/}
CATEGORIES= time python
MASTER_SITES= ${MASTER_SITE_PYPI:=t/time-machine/}
@@ -11,7 +11,8 @@ COMMENT= Travel through time in your tes
LICENSE= mit
TOOL_DEPENDS+= ${PYPKGPREFIX}-setuptools>=78:../../devel/py-setuptools
-DEPENDS+= ${PYPKGPREFIX}-dateutil-[0-9]*:../../time/py-dateutil
+# dateutil
+DEPENDS+= ${PYPKGPREFIX}-dateutil>=2.8.2:../../time/py-dateutil
.include "../../lang/python/wheel.mk"
.include "../../mk/bsd.pkg.mk"
Index: pkgsrc/time/py-time-machine/distinfo
diff -u pkgsrc/time/py-time-machine/distinfo:1.10 pkgsrc/time/py-time-machine/distinfo:1.11
--- pkgsrc/time/py-time-machine/distinfo:1.10 Thu Aug 21 07:11:27 2025
+++ pkgsrc/time/py-time-machine/distinfo Mon Dec 1 13:25:48 2025
@@ -1,5 +1,5 @@
-$NetBSD: distinfo,v 1.10 2025/08/21 07:11:27 adam Exp $
+$NetBSD: distinfo,v 1.11 2025/12/01 13:25:48 adam Exp $
-BLAKE2s (time_machine-2.19.0.tar.gz) = b4b88e5957982f034d809836fee2f446d2f00b117b9deed0e3aaeef43a696fa4
-SHA512 (time_machine-2.19.0.tar.gz) = 922d37c29aea413fb5accb8f020467b697db3c9b38081f9d2ad154cbeb8c9c960f1a10836e316f7fa2c5155c4e5e4d8f0c04322981da59c45dac59890072c670
-Size (time_machine-2.19.0.tar.gz) = 14576 bytes
+BLAKE2s (time_machine-3.1.0.tar.gz) = 566b7f7851df61cd6c6d03f81145d8f00643ad8876ae5af9252e08a3d3095944
+SHA512 (time_machine-3.1.0.tar.gz) = 634a6c7d54141dd3f0b8d0b8469dab022b7554b62f746a627f266b7be252390ae7380a0f960afd48fdc2dddee7280b41cea7fd25125c8c2329907285da1202a9
+Size (time_machine-3.1.0.tar.gz) = 14436 bytes
Home |
Main Index |
Thread Index |
Old Index