summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2014-12-14 20:17:03 +0000
committerAndrew Bartlett <abartlet@samba.org>2015-03-06 04:41:47 +0100
commit039fa938b1cfed1f973b675648a2285c7b5d4ca0 (patch)
treeeebc67ac6010c117323858a341f38f2a28da4435
parent8c6d85b81781a85842c38be12ce431172594e159 (diff)
downloadsamba-039fa938b1cfed1f973b675648a2285c7b5d4ca0.tar.gz
samba-039fa938b1cfed1f973b675648a2285c7b5d4ca0.tar.xz
samba-039fa938b1cfed1f973b675648a2285c7b5d4ca0.zip
Import UTC definition from utc8601 module.
Change-Id: I3ccd81090c4721b161aff272100aa71bc2f17055 Signed-off-by: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r--python/samba/subunit/__init__.py21
-rwxr-xr-xpython/samba/subunit/run.py6
2 files changed, 3 insertions, 24 deletions
diff --git a/python/samba/subunit/__init__.py b/python/samba/subunit/__init__.py
index bd320fdc25..ab55ace104 100644
--- a/python/samba/subunit/__init__.py
+++ b/python/samba/subunit/__init__.py
@@ -17,7 +17,6 @@
"""Subunit test protocol."""
-import datetime
import unittest
@@ -27,26 +26,6 @@ PROGRESS_PUSH = 2
PROGRESS_POP = 3
-# From http://docs.python.org/library/datetime.html
-_ZERO = datetime.timedelta(0)
-
-# A UTC class.
-
-class UTC(datetime.tzinfo):
- """UTC"""
-
- def utcoffset(self, dt):
- return _ZERO
-
- def tzname(self, dt):
- return "UTC"
-
- def dst(self, dt):
- return _ZERO
-
-utc = UTC()
-
-
def RemoteError(description=""):
return (Exception, Exception(description), None)
diff --git a/python/samba/subunit/run.py b/python/samba/subunit/run.py
index 0eb2913919..cde6febdaf 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 samba.subunit import UTC
+from iso8601.iso8601 import Utc
import datetime
import os
@@ -189,7 +189,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))
@@ -471,7 +471,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