[ARVADOS] created: 98f1b8341b1d50158727ec7390ba446a808925d5
git at public.curoverse.com
git at public.curoverse.com
Thu Feb 19 10:18:23 EST 2015
at 98f1b8341b1d50158727ec7390ba446a808925d5 (commit)
commit 98f1b8341b1d50158727ec7390ba446a808925d5
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Thu Feb 19 10:20:34 2015 -0500
5277: Add test for mtime. Use ciso8601 module to parse arvados timestamps.
diff --git a/services/fuse/arvados_fuse/__init__.py b/services/fuse/arvados_fuse/__init__.py
index 71c4ee5..5cc6660 100644
--- a/services/fuse/arvados_fuse/__init__.py
+++ b/services/fuse/arvados_fuse/__init__.py
@@ -20,6 +20,7 @@ import _strptime
import calendar
import threading
import itertools
+import ciso8601
from arvados.util import portable_data_hash_pattern, uuid_pattern, collection_uuid_pattern, group_uuid_pattern, user_uuid_pattern, link_uuid_pattern
@@ -69,7 +70,7 @@ def convertTime(t):
if not t:
return 0
try:
- return calendar.timegm(time.strptime(t, "%Y-%m-%dT%H:%M:%SZ"))
+ return calendar.timegm(ciso8601.parse_datetime_unaware(t).timetuple())
except (TypeError, ValueError):
return 0
diff --git a/services/fuse/setup.py b/services/fuse/setup.py
index 9c825c6..7132481 100644
--- a/services/fuse/setup.py
+++ b/services/fuse/setup.py
@@ -32,6 +32,7 @@ setup(name='arvados_fuse',
'arvados-python-client>=0.1.20150206225333',
'llfuse',
'python-daemon',
+ 'ciso8601'
],
test_suite='tests',
tests_require=['PyYAML'],
diff --git a/services/fuse/tests/test_mount.py b/services/fuse/tests/test_mount.py
index f9fcd73..379a130 100644
--- a/services/fuse/tests/test_mount.py
+++ b/services/fuse/tests/test_mount.py
@@ -259,14 +259,26 @@ class FuseSharedTest(MountTestBase):
# Double check that we can open and read objects in this folder as a file,
# and that its contents are what we expect.
- with open(os.path.join(
+ pipeline_template_path = os.path.join(
self.mounttmp,
'FUSE User',
'FUSE Test Project',
- 'pipeline template in FUSE project.pipelineTemplate')) as f:
+ 'pipeline template in FUSE project.pipelineTemplate')
+ with open(pipeline_template_path) as f:
j = json.load(f)
self.assertEqual("pipeline template in FUSE project", j['name'])
+ # check mtime on template
+ st = os.stat(pipeline_template_path)
+ self.assertEqual(st.st_mtime, 1397493304)
+
+ # check mtime on collection
+ st = os.stat(os.path.join(
+ self.mounttmp,
+ 'FUSE User',
+ 'collection #1 owned by FUSE'))
+ self.assertEqual(st.st_mtime, 1391448174)
+
class FuseHomeTest(MountTestBase):
def runTest(self):
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list