@@ -172,6 +172,12 @@ def recast(k):
172
172
return (config , auth )
173
173
174
174
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
+
175
181
# Create a connection for test, based on ~/.irods environment by default.
176
182
177
183
@@ -193,7 +199,7 @@ def make_session(test_server_version=True, **kwargs):
193
199
env_file = env_filename_from_keyword_args (kwargs )
194
200
session = iRODSSession (irods_env_file = env_file , ** kwargs )
195
201
if test_server_version :
196
- connected_version = session . server_version [: 3 ]
202
+ connected_version = get_server_version_for_test ( session , curtail_length = 3 )
197
203
advertised_version = IRODS_VERSION [:3 ]
198
204
if connected_version > advertised_version :
199
205
msg = (
@@ -430,26 +436,6 @@ def enableLogging(logger, handlerType, args, level_=logging.INFO):
430
436
logger .removeHandler (h )
431
437
432
438
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
-
453
439
# Implement a server-side wait that ensures no TCP communication from server end for a given interval.
454
440
# Useful to test the effect of socket inactivity on a client. See python-irodsclient issue #569
455
441
def server_side_sleep (session , seconds ):
0 commit comments