diff --git a/irods/client_configuration/__init__.py b/irods/client_configuration/__init__.py index 505b48b0d..9e836a8d2 100644 --- a/irods/client_configuration/__init__.py +++ b/irods/client_configuration/__init__.py @@ -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 @@ -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 @@ -89,6 +96,7 @@ def irods_query_limit(self, target_value): class DataObjects(iRODSConfiguration): + __slots__ = ( "auto_close", "allow_redirect", diff --git a/irods/test/client_configuration_test.py b/irods/test/client_configuration_test.py new file mode 100644 index 000000000..892deab5a --- /dev/null +++ b/irods/test/client_configuration_test.py @@ -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 + #print(f'{count = }/{success = }')