@@ -172,6 +172,12 @@ def recast(k):
172172 return (config , auth )
173173
174174
175+ def get_server_version_for_test (session , curtail_length ):
176+ return session ._server_version (session .GET_SERVER_VERSION_WITHOUT_AUTH )[
177+ :curtail_length
178+ ]
179+
180+
175181# Create a connection for test, based on ~/.irods environment by default.
176182
177183
@@ -193,7 +199,7 @@ def make_session(test_server_version=True, **kwargs):
193199 env_file = env_filename_from_keyword_args (kwargs )
194200 session = iRODSSession (irods_env_file = env_file , ** kwargs )
195201 if test_server_version :
196- connected_version = session . server_version [: 3 ]
202+ connected_version = get_server_version_for_test ( session , curtail_length = 3 )
197203 advertised_version = IRODS_VERSION [:3 ]
198204 if connected_version > advertised_version :
199205 msg = (
@@ -430,26 +436,6 @@ def enableLogging(logger, handlerType, args, level_=logging.INFO):
430436 logger .removeHandler (h )
431437
432438
433- class _unlikely_value :
434- pass
435-
436-
437- @contextlib .contextmanager
438- def temporarily_assign_attribute (
439- target , attr , value , not_set_indicator = _unlikely_value ()
440- ):
441- save = not_set_indicator
442- try :
443- save = getattr (target , attr , not_set_indicator )
444- setattr (target , attr , value )
445- yield
446- finally :
447- if save != not_set_indicator :
448- setattr (target , attr , save )
449- else :
450- delattr (target , attr )
451-
452-
453439# Implement a server-side wait that ensures no TCP communication from server end for a given interval.
454440# Useful to test the effect of socket inactivity on a client. See python-irodsclient issue #569
455441def server_side_sleep (session , seconds ):
0 commit comments