Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions irods/client_configuration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ def __new__(meta, name, bases, attrs):


class ConnectionsProperties(iRODSConfiguration, metaclass=iRODSConfigAliasMetaclass):

__slots__=()

@property
def xml_parser_default(self):
from irods.message import get_default_XML_by_name
Expand All @@ -59,11 +62,15 @@ def xml_parser_default(self, str_value):

connections = ConnectionsProperties()


class ConfigurationError(BaseException): pass
class ConfigurationValueError(ValueError,ConfigurationError): pass


class Genquery1_Properties(iRODSConfiguration, metaclass=iRODSConfigAliasMetaclass):

__slots__ = ()

@property
def irods_query_limit(self):
import irods.query
Expand All @@ -89,6 +96,7 @@ def irods_query_limit(self, target_value):


class DataObjects(iRODSConfiguration):

__slots__ = (
"auto_close",
"allow_redirect",
Expand Down
39 changes: 39 additions & 0 deletions irods/test/client_configuration_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import unittest
import irods
import irods.client_configuration as cfg

# Test assignments on the negative and positive space of the
# client configuration.

class TestClientConfigurationAttributes(unittest.TestCase):

def test_hits_and_misses__issue_708(self):
# For caching configuration objects
configuration_level = {}

#count=0; success=0
for dotted_name, value, is_conf in cfg._var_items_as_generator():
with self.subTest(dotted_name=dotted_name):
name_parts=dotted_name.split('.')
namespace='.'.join(name_parts[:-1])
attribute_name=name_parts[-1]
if isinstance(value, cfg.iRODSConfiguration):
configuration_level[dotted_name]=value
else:
if is_conf:
#count += 1
try:
# Test the positive space, i.e. the 'hit'
setattr(configuration_level[namespace],attribute_name,value)

#print(namespace, attribute_name, value)

# Test the negative space, i.e. the 'miss'
with self.assertRaises(AttributeError):
setattr(configuration_level[namespace],attribute_name+'_1',value)
except Exception as exc:
self.fail(f"shouldn't fail but raised {exc = }")
else:
pass
#success += 1
Comment on lines +36 to +38
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should the else be pulled one indentation back to match the if?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the else is supposed to match the try/except. But... it's also empty, so it may not be necessary, in any case.

Copy link
Collaborator Author

@d-w-moore d-w-moore Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, the else matches the try/except. the else clause runs if no exceptions are thrown.

Other places an else might not be expected, but is actually valid, is after a for loop , in which case it runs if the loop completes normally (rather than break-ing out)

And yes, I'll be taking out the counter variables success and count, eventually.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotcha, carry on!

#print(f'{count = }/{success = }')
Loading