Skip to content

Commit

Permalink
remove test helper In_Memory_Stream, construct file-like objects dire…
Browse files Browse the repository at this point in the history
…ctly
  • Loading branch information
d-w-moore committed Oct 17, 2024
1 parent ed29894 commit ea9fc7c
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions irods/test/data_obj_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,6 @@ def tearDown(self):
self.coll.remove(recurse=True, force=True)
self.sess.cleanup()

@staticmethod
def In_Memory_Stream(always_unicode = False):
return io.StringIO() if sys.version_info >= (3,) or always_unicode \
else io.BytesIO()


@contextlib.contextmanager
def create_resc_hierarchy (self, Root, Leaf = None):
Expand Down Expand Up @@ -329,8 +324,8 @@ def test_put_get_parallel_autoswitch_A__235(self):
options = { kw.DEST_RESC_NAME_KW:Root,
kw.RESC_NAME_KW:Root }

PUT_LOG = self.In_Memory_Stream(always_unicode = True)
GET_LOG = self.In_Memory_Stream(always_unicode = True)
PUT_LOG = io.StringIO()
GET_LOG = io.StringIO()
NumThreadsRegex = re.compile('^num_threads\s*=\s*(\d+)',re.MULTILINE)

try:
Expand Down Expand Up @@ -842,7 +837,7 @@ def do_test_redirect_in_data_object_put_and_get__issue_452(self, content, data_c
data_ctx['initialize']()
sess = data_ctx['session']
remote_name = data_ctx['path']
PUT_LOG = self.In_Memory_Stream(always_unicode = True)
PUT_LOG = io.StringIO()
with helpers.enableLogging(logging.getLogger('irods.manager.data_object_manager'),
logging.StreamHandler, (PUT_LOG,), level_ = logging.DEBUG),\
helpers.enableLogging(logging.getLogger('irods.parallel'),
Expand Down Expand Up @@ -872,7 +867,7 @@ def assert_expected_redirection_logging(BUF):
data_ctx_get = next(generator)
data_ctx_get['initialize']()
sess = data_ctx_get['session']
GET_LOG = self.In_Memory_Stream(always_unicode = True)
GET_LOG = io.StringIO()
with helpers.enableLogging(logging.getLogger('irods.manager.data_object_manager'),
logging.StreamHandler, (GET_LOG,), level_ = logging.DEBUG),\
helpers.enableLogging(logging.getLogger('irods.parallel'),
Expand Down Expand Up @@ -2181,7 +2176,7 @@ def assert_redirect_happens_on_open(self, open_opts):
name = 'redirect_happens_' + unique_name (my_function_name(), datetime.now())
data_path = '{self.coll_path}/{name}'.format(**locals())
try:
PUT_LOG = self.In_Memory_Stream(always_unicode = True)
PUT_LOG = io.StringIO()
with helpers.enableLogging(logging.getLogger('irods.manager.data_object_manager'),
logging.StreamHandler, (PUT_LOG,), level_ = logging.DEBUG):
with self.sess.data_objects.open(data_path,'w',**open_opts):
Expand Down

0 comments on commit ea9fc7c

Please sign in to comment.