Skip to content

Commit 7c458ff

Browse files
d-w-moorealanking
authored andcommitted
[#3][#525] allow touch API tests to run on Python 2
1 parent 7f515ff commit 7c458ff

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

irods/test/collection_test.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,8 @@ def test_touch_operation_does_not_create_new_collections__525(self):
420420
user_session = self.logins.session_for_user(RODSUSER)
421421

422422
# The collection should not exist.
423-
collection_path = f'{helpers.home_collection(user_session)}/test_touch_operation_does_not_create_new_collections__525'
423+
home_collection = helpers.home_collection(user_session)
424+
collection_path = '{home_collection}/test_touch_operation_does_not_create_new_collections__525'.format(**locals())
424425
with self.assertRaises(CollectionDoesNotExist):
425426
user_session.collections.get(collection_path)
426427

@@ -436,9 +437,10 @@ def test_touch_operation_does_not_create_new_collections__525(self):
436437
def test_touch_operation_does_not_work_when_given_a_data_object__525(self):
437438
try:
438439
user_session = self.logins.session_for_user(RODSUSER)
440+
home_collection = helpers.home_collection(user_session)
439441

440442
# Create a data object.
441-
data_object_path = f'{helpers.home_collection(user_session)}/test_touch_operation_does_not_work_when_given_a_data_object__525.txt'
443+
data_object_path = '{home_collection}/test_touch_operation_does_not_work_when_given_a_data_object__525.txt'.format(**locals())
442444
self.assertFalse(user_session.data_objects.exists(data_object_path))
443445
user_session.data_objects.touch(data_object_path)
444446
self.assertTrue(user_session.data_objects.exists(data_object_path))
@@ -453,7 +455,9 @@ def test_touch_operation_does_not_work_when_given_a_data_object__525(self):
453455

454456
def test_touch_operation_ignores_unsupported_options__525(self):
455457
user_session = self.logins.session_for_user(RODSUSER)
456-
path = f'{helpers.home_collection(user_session)}/test_touch_operation_ignores_unsupported_options__525'
458+
459+
home_collection = helpers.home_collection(user_session)
460+
path = '{home_collection}/test_touch_operation_ignores_unsupported_options__525'.format(**locals())
457461

458462
try:
459463
# Capture mtime of the home collection.

irods/test/data_obj_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2059,11 +2059,14 @@ def test_append_mode_will_append_to_data_object__issue_495(self):
20592059
data.unlink(testfile,force=True)
20602060

20612061
def test_update_mtime_of_data_object_using_touch_operation_as_non_admin__525(self):
2062+
# prevent UnboundLocalError
2063+
data_object = None
20622064
try:
20632065
user_session = self.logins.session_for_user(RODSUSER)
20642066

20652067
# Create a data object.
2066-
data_object_path = f'{helpers.home_collection(user_session)}/test_update_mtime_of_data_object_using_touch_operation__525.txt'
2068+
home_collection = helpers.home_collection(user_session)
2069+
data_object_path = '{home_collection}/test_update_mtime_of_data_object_using_touch_operation__525.txt'.format(**locals())
20672070
self.assertFalse(user_session.data_objects.exists(data_object_path))
20682071
user_session.data_objects.touch(data_object_path)
20692072
self.assertTrue(user_session.data_objects.exists(data_object_path))

0 commit comments

Comments
 (0)