diff --git a/scripts/irods/test/test_prep_genquery_iterator.py b/scripts/irods/test/test_prep_genquery_iterator.py index 0a0a4a6292..ce2085e6ae 100644 --- a/scripts/irods/test/test_prep_genquery_iterator.py +++ b/scripts/irods/test/test_prep_genquery_iterator.py @@ -1045,25 +1045,27 @@ def test_genquery_iterator_allows_close_member_function_to_be_called_multiple_ti attr_name = 'test_genquery_iterator_allows_close_member_function_to_be_called_multiple_times__issue_7909' attr_value = 'success' - # The following rule calls the close() member function of the Query class multiple - # times and then attaches an AVU to the session collection. The AVU is used to - # indicate success. - core.add_rule(dedent(f''' - def pep_api_touch_pre(rule_args, callback, rei): - from genquery import Query, Parser - query = Query(callback, 'COLL_NAME', "COLL_NAME = '{self.admin.session_collection}'", parser=Parser.GENQUERY2) - for _ in query: - pass - query.close() - query.close() - query.close() - callback.msiModAVUMetadata('-C', '{self.admin.session_collection}', 'add', '{attr_name}', '{attr_value}', '') - ''')) - - # Trigger the PEP. - self.admin.assert_icommand(['itouch', 'issue_7909'], 'STDERR') - - # Show the AVU is now attached to the session collection with the expected attribute value. - self.admin.assert_icommand(['imeta', 'ls', '-C', self.admin.session_collection], 'STDOUT', [ - f'attribute: {attr_name}\nvalue: {attr_value}\n' - ]) + for parser in ['GENQUERY1', 'GENQUERY2']: + with self.subTest(f'Using [{parser}]'): + # The following rule calls the close() member function of the Query class multiple + # times and then attaches an AVU to the session collection. The AVU is used to + # indicate success. + core.add_rule(dedent(f''' + def pep_api_touch_pre(rule_args, callback, rei): + from genquery import Query, Parser + query = Query(callback, 'COLL_NAME', "COLL_NAME = '{self.admin.session_collection}'", parser=Parser.{parser}) + for _ in query: + pass + query.close() + query.close() + query.close() + callback.msiModAVUMetadata('-C', '{self.admin.session_collection}', 'add', '{attr_name}', '{parser}={attr_value}', '') + ''')) + + # Trigger the PEP. + self.admin.assert_icommand(['itouch', 'issue_7909'], 'STDERR') + + # Show the AVU is now attached to the session collection with the expected attribute value. + self.admin.assert_icommand(['imeta', 'ls', '-C', self.admin.session_collection], 'STDOUT', [ + f'attribute: {attr_name}\nvalue: {parser}={attr_value}\n' + ])