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
12 changes: 6 additions & 6 deletions supervisor/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,9 @@ def get_plugins(self, parser, factory_key, section_prefix):
(section, factory_key))
try:
factory = self.import_spec(factory_spec)
except (AttributeError, ImportError):
raise ValueError('%s cannot be resolved within [%s]' % (
factory_spec, section))
except (AttributeError, ImportError) as e:
raise ValueError('%s cannot be resolved within [%s]: %s' % (
factory_spec, section, e))

extras = {}
for k in parser.options(section):
Expand Down Expand Up @@ -743,9 +743,9 @@ def get(section, opt, default, **kwargs):
'supervisor.dispatchers:default_handler')
try:
result_handler = self.import_spec(result_handler)
except (AttributeError, ImportError):
raise ValueError('%s cannot be resolved within [%s]' % (
result_handler, section))
except (AttributeError, ImportError) as e:
raise ValueError('%s cannot be resolved within [%s]: %s' % (
result_handler, section, e))

pool_event_names = [x.upper() for x in
list_of_strings(get(section, 'events', ''))]
Expand Down
8 changes: 5 additions & 3 deletions supervisor/tests/test_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -2644,7 +2644,8 @@ def test_event_listener_pool_result_handler_unimportable_ImportError(self):
except ValueError as exc:
self.assertEqual(exc.args[0],
'thisishopefullynotanimportablepackage:nonexistent cannot be '
'resolved within [eventlistener:cat]')
'resolved within [eventlistener:cat]: No module named '
'\'thisishopefullynotanimportablepackage\'')
Copy link
Author

Choose a reason for hiding this comment

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

I am not sure how to handle the quoting issues here.


def test_event_listener_pool_result_handler_unimportable_AttributeError(self):
text = lstrip("""\
Expand All @@ -2663,7 +2664,8 @@ def test_event_listener_pool_result_handler_unimportable_AttributeError(self):
except ValueError as exc:
self.assertEqual(exc.args[0],
'supervisor.tests.base:nonexistent cannot be '
'resolved within [eventlistener:cat]')
'resolved within [eventlistener:cat]: module '
'\'supervisor.tests.base\' has no attribute \'nonexistent\'')

def test_event_listener_pool_noeventsline(self):
text = lstrip("""\
Expand Down Expand Up @@ -3216,7 +3218,7 @@ def test_rpcinterfaces_from_parser_factory_not_importable(self):
self.fail('nothing raised')
except ValueError as exc:
self.assertEqual(exc.args[0], 'nonexistent cannot be resolved '
'within [rpcinterface:dummy]')
'within [rpcinterface:dummy]: No module named \'nonexistent\'')

def test_clear_autochildlogdir(self):
dn = tempfile.mkdtemp()
Expand Down
Loading