@@ -128,6 +128,26 @@ def test_get_handler(self):
128128 self .assertEqual ("tests" , handler_module )
129129 self .assertEqual ("lambda_handler" , handler_function )
130130
131+ def test_get_handler_with_multi_subpackages (self ):
132+ os .environ ["LAMBDA_HANDLER" ] = "tests.one.two.three.lambda_handler"
133+ handler_module , handler_function = get_lambda_handler_or_default ()
134+
135+ self .assertEqual ("tests.one.two.three" , handler_module )
136+ self .assertEqual ("lambda_handler" , handler_function )
137+
138+ def test_get_handler_with_space_in_it (self ):
139+ os .environ ["LAMBDA_HANDLER" ] = " tests.another_module.lambda_handler"
140+ handler_module , handler_function = get_lambda_handler_or_default ()
141+
142+ self .assertEqual ("tests.another_module" , handler_module )
143+ self .assertEqual ("lambda_handler" , handler_function )
144+
145+ os .environ ["LAMBDA_HANDLER" ] = "tests.another_module.lambda_handler "
146+ handler_module , handler_function = get_lambda_handler_or_default ()
147+
148+ self .assertEqual ("tests.another_module" , handler_module )
149+ self .assertEqual ("lambda_handler" , handler_function )
150+
131151 def test_agent_extra_http_headers (self ):
132152 os .environ ['INSTANA_EXTRA_HTTP_HEADERS' ] = "X-Test-Header;X-Another-Header;X-And-Another-Header"
133153 self .create_agent_and_setup_tracer ()
@@ -590,4 +610,4 @@ def test_agent_default_log_level(self):
590610 def test_agent_custom_log_level (self ):
591611 os .environ ['INSTANA_LOG_LEVEL' ] = "eRror"
592612 self .create_agent_and_setup_tracer ()
593- assert self .agent .options .log_level == logging .ERROR
613+ assert self .agent .options .log_level == logging .ERROR
0 commit comments