The Samba-Bugzilla – Attachment 15324 Details for
Bug 13835
[4.10 backport needed]subunit/run.py: make iso8601 UTC usage python 2/3 compatible
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
the patch with cherry-picked-from
0001-subunit-run.py-make-iso8601-UTC-usage-python-2-3-com.patch (text/plain), 1.92 KB, created by
Douglas Bagnall
on 2019-07-25 02:36:33 UTC
(
hide
)
Description:
the patch with cherry-picked-from
Filename:
MIME Type:
Creator:
Douglas Bagnall
Created:
2019-07-25 02:36:33 UTC
Size:
1.92 KB
patch
obsolete
>From 4068a1877ec96693c698268bc6da9ead722cf1ad Mon Sep 17 00:00:00 2001 >From: Joe Guo <joeg@catalyst.net.nz> >Date: Thu, 7 Mar 2019 12:34:15 +1300 >Subject: [PATCH] subunit/run.py: make iso8601 UTC usage python 2/3 compatible > >In `iso8601/iso8601.py`: > > if sys.version_info >= (3, 2, 0): > UTC = datetime.timezone.utc > ... > else: > class Utc(datetime.tzinfo): > ... > > UTC = Utc() > >The class `Utc` is only available for python < 3.2.0. >Use `UTC` instance instead, which is python 2/3 compatible. > >Signed-off-by: Joe Guo <joeg@catalyst.net.nz> >Reviewed-by: Andrew Bartlett <abartlet@samba.org> >Reviewed-by: Noel Power <npower@samba.org> >(cherry picked from commit 02c7b8c03d4970421a5170e44c57cbc3cda82827) >--- > python/samba/subunit/run.py | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > >diff --git a/python/samba/subunit/run.py b/python/samba/subunit/run.py >index 8f32d46ef49..89ca8a8050b 100755 >--- a/python/samba/subunit/run.py >+++ b/python/samba/subunit/run.py >@@ -24,7 +24,7 @@ > $ python -m samba.subunit.run mylib.tests.test_suite > """ > >-from iso8601.iso8601 import Utc >+from iso8601.iso8601 import UTC > > import datetime > import os >@@ -184,7 +184,7 @@ class TestProtocolClient(unittest.TestResult): > > ":param datetime: A datetime.datetime object. > """ >- time = a_datetime.astimezone(Utc()) >+ time = a_datetime.astimezone(UTC) > self._stream.write("time: %04d-%02d-%02d %02d:%02d:%02d.%06dZ\n" % ( > time.year, time.month, time.day, time.hour, time.minute, > time.second, time.microsecond)) >@@ -458,7 +458,7 @@ class AutoTimingTestResultDecorator(HookedTestResultDecorator): > time = self._time > if time is not None: > return >- time = datetime.datetime.utcnow().replace(tzinfo=Utc()) >+ time = datetime.datetime.utcnow().replace(tzinfo=UTC) > self.decorated.time(time) > > @property >-- >2.20.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
dbagnall
:
review?
(
abartlet
)
dbagnall
:
review+
Actions:
View
Attachments on
bug 13835
:
14924
| 15324