The Samba-Bugzilla – Attachment 14924 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]
subunit/run.py: make iso8601 UTC usage python 2/3 compatible
0001-subunit-run-iso8601-utc-py3.patch (text/plain), 1.84 KB, created by
Joe Guo (mail address dead)
on 2019-03-12 21:47:56 UTC
(
hide
)
Description:
subunit/run.py: make iso8601 UTC usage python 2/3 compatible
Filename:
MIME Type:
Creator:
Joe Guo (mail address dead)
Created:
2019-03-12 21:47:56 UTC
Size:
1.84 KB
patch
obsolete
>From 02c7b8c03d4970421a5170e44c57cbc3cda82827 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> >--- > 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 8f32d46..89ca8a8 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.7.4 >
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
Actions:
View
Attachments on
bug 13835
:
14924
|
15324