File tree Expand file tree Collapse file tree 4 files changed +23
-0
lines changed
test_built_in_module_name Expand file tree Collapse file tree 4 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ def _get_handler(handler):
3636 "Cannot use built-in module {} as a handler module" .format (modname ),
3737 )
3838 return make_fault_handler (fault )
39+ modname = modname .replace ("/" , "." )
3940 m = importlib .import_module (modname )
4041 except ImportError as e :
4142 fault = FaultException (
Original file line number Diff line number Diff line change @@ -780,6 +780,12 @@ def test_get_event_handler_missing_error(self):
780780 returned_exception ,
781781 )
782782
783+ def test_get_event_handler_slash (self ):
784+ importlib .invalidate_caches ()
785+ handler_name = "tests/test_handler_with_slash/test_handler.my_handler"
786+ response_handler = bootstrap ._get_handler (handler_name )
787+ response_handler ()
788+
783789 def test_get_event_handler_build_in_conflict (self ):
784790 response_handler = bootstrap ._get_handler ("sys.hello" )
785791 with self .assertRaises (FaultException ) as cm :
@@ -793,6 +799,18 @@ def test_get_event_handler_build_in_conflict(self):
793799 returned_exception ,
794800 )
795801
802+ def test_get_event_handler_doesnt_throw_build_in_module_name_slash (self ):
803+ response_handler = bootstrap ._get_handler (
804+ "tests/test_built_in_module_name/sys.my_handler"
805+ )
806+ response_handler ()
807+
808+ def test_get_event_handler_doent_throw_build_in_module_name (self ):
809+ response_handler = bootstrap ._get_handler (
810+ "tests.test_built_in_module_name.sys.my_handler"
811+ )
812+ response_handler ()
813+
796814
797815class TestContentType (unittest .TestCase ):
798816 def setUp (self ):
Original file line number Diff line number Diff line change 1+ def my_handler ():
2+ return "Same name as Built in module, but different path"
Original file line number Diff line number Diff line change 1+ def my_handler ():
2+ return "Good with slash"
You can’t perform that action at this time.
0 commit comments