[ARVADOS] updated: 1.3.0-972-g11b5f0482
Git user
git at public.curoverse.com
Mon Jun 10 22:45:25 UTC 2019
Summary of changes:
sdk/python/arvados/commands/put.py | 10 ++++++++--
sdk/python/tests/test_arv_put.py | 14 +++++++++++---
2 files changed, 19 insertions(+), 5 deletions(-)
via 11b5f048229cc5afa785274e555d0874e9405397 (commit)
from 64eadab02f0ffd58b3b6c66c463b91abe07ecc07 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 11b5f048229cc5afa785274e555d0874e9405397
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date: Mon Jun 10 19:44:47 2019 -0300
14930: Don't ignore DST settings.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>
diff --git a/sdk/python/arvados/commands/put.py b/sdk/python/arvados/commands/put.py
index 4b04ad229..5773cb4f9 100644
--- a/sdk/python/arvados/commands/put.py
+++ b/sdk/python/arvados/commands/put.py
@@ -1142,7 +1142,10 @@ def main(arguments=None, stdout=sys.stdout, stderr=sys.stderr,
utcoffset = -trash_at.utcoffset()
else:
# Timezone naive datetime provided. Assume is local.
- utcoffset = datetime.timedelta(seconds=time.timezone)
+ if time.daylight:
+ utcoffset = datetime.timedelta(seconds=time.altzone)
+ else:
+ utcoffset = datetime.timedelta(seconds=time.timezone)
# Convert to UTC timezone naive datetime.
trash_at = trash_at.replace(tzinfo=None) + utcoffset
@@ -1316,7 +1319,10 @@ def main(arguments=None, stdout=sys.stdout, stderr=sys.stderr,
expiration_notice = ""
if writer.collection_trash_at() is not None:
# Get the local timezone-naive version, and log it with timezone information.
- local_trash_at = writer.collection_trash_at().replace(tzinfo=None) - datetime.timedelta(seconds=time.timezone)
+ if time.daylight:
+ local_trash_at = writer.collection_trash_at().replace(tzinfo=None) - datetime.timedelta(seconds=time.altzone)
+ else:
+ local_trash_at = writer.collection_trash_at().replace(tzinfo=None) - datetime.timedelta(seconds=time.timezone)
expiration_notice = ". It will expire on {} {}.".format(
local_trash_at.strftime("%Y-%m-%d %H:%M:%S"), time.strftime("%z"))
if args.update_collection:
diff --git a/sdk/python/tests/test_arv_put.py b/sdk/python/tests/test_arv_put.py
index d27ac9be0..42adf2450 100644
--- a/sdk/python/tests/test_arv_put.py
+++ b/sdk/python/tests/test_arv_put.py
@@ -1198,11 +1198,15 @@ class ArvPutIntegrationTest(run_test_server.TestCaseWithServers,
['--no-progress', '--trash-at', trash_at, tmpdir])
self.assertNotEqual(None, col['uuid'])
c = arv_put.api_client.collections().get(uuid=col['uuid']).execute()
+ if time.daylight:
+ offset = datetime.timedelta(seconds=time.altzone)
+ else:
+ offset = datetime.timedelta(seconds=time.timezone)
self.assertEqual(
- ciso8601.parse_datetime(trash_at) + datetime.timedelta(seconds=time.timezone),
+ ciso8601.parse_datetime(trash_at) + offset,
ciso8601.parse_datetime(c['trash_at']).replace(tzinfo=None))
- def test_put_collection_with_timezone_expiring_date_only(self):
+ def test_put_collection_with_expiring_date_only(self):
tmpdir = self.make_tmpdir()
trash_at = '2140-01-01'
end_of_day = datetime.timedelta(hours=23, minutes=59, seconds=59)
@@ -1213,8 +1217,12 @@ class ArvPutIntegrationTest(run_test_server.TestCaseWithServers,
['--no-progress', '--trash-at', trash_at, tmpdir])
self.assertNotEqual(None, col['uuid'])
c = arv_put.api_client.collections().get(uuid=col['uuid']).execute()
+ if time.daylight:
+ offset = datetime.timedelta(seconds=time.altzone)
+ else:
+ offset = datetime.timedelta(seconds=time.timezone)
self.assertEqual(
- ciso8601.parse_datetime(trash_at) + end_of_day + datetime.timedelta(seconds=time.timezone),
+ ciso8601.parse_datetime(trash_at) + end_of_day + offset,
ciso8601.parse_datetime(c['trash_at']).replace(tzinfo=None))
def test_put_collection_with_invalid_absolute_expiring_datetimes(self):
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list