mirror of
https://github.com/samba-team/samba.git
synced 2025-01-08 21:18:16 +03:00
Import UTC definition from utc8601 module.
Change-Id: I3ccd81090c4721b161aff272100aa71bc2f17055 Signed-off-by: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
8c6d85b817
commit
039fa938b1
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user