Azure / azure-functions-python-worker

Python worker for Azure Functions.
http://aka.ms/azurefunctions
MIT License
335 stars 103 forks source link

Adding missing inits in tests to correct binding load errors #1354

Closed vrdmr closed 10 months ago

vrdmr commented 10 months ago

Description

Fixing the following UT errors

FAILED tests/unittests/test_dispatcher.py::TestThreadPoolSettingsPython37::test_dispatcher_sync_threadpool_set_worker - AssertionError: 0 != 1 : stack_trace: "  File \"/home/runner/work/azure-functions-python-worker/azure-functions-python-worker/azure_functions_worker/dispatcher.py\", line 399, in _handle__function_load_request\n    self._functions.add_function(\n  File \"/home/runner/work/azure-functions-python-worker/azure-functions-python-worker/azure_functions_worker/functions.py\", line 338, in add_function\n    input_types, output_types = self.validate_function_params(params,\n  File \"/home/runner/work/azure-functions-python-worker/azure-functions-python-worker/azure_functions_worker/functions.py\", line 228, in validate_function_params\n    raise FunctionLoadError(\n"
message: "FunctionLoadError: cannot load the show_context function: type of req binding in function.json \"httpTrigger\" does not match its Python annotation \"HttpRequest\""
FAILED tests/unittests/test_dispatcher.py::TestThreadPoolSettingsPython37::test_sync_invocation_request_log_threads - AssertionError: 0 != 1 : stack_trace: "  File \"/home/runner/work/azure-functions-python-worker/azure-functions-python-worker/azure_functions_worker/dispatcher.py\", line 399, in _handle__function_load_request\n    self._functions.add_function(\n  File \"/home/runner/work/azure-functions-python-worker/azure-functions-python-worker/azure_functions_worker/functions.py\", line 338, in add_function\n    input_types, output_types = self.validate_function_params(params,\n  File \"/home/runner/work/azure-functions-python-worker/azure-functions-python-worker/azure_functions_worker/functions.py\", line 228, in validate_function_params\n    raise FunctionLoadError(\n"
message: "FunctionLoadError: cannot load the show_context function: type of req binding in function.json \"httpTrigger\" does not match its Python annotation \"HttpRequest\""

Fixes #


PR information

Quality of Code and Contribution Guidelines

codecov[bot] commented 10 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (a86adb4) 85.51% compared to head (d90a732) 32.11%.

:exclamation: Current head d90a732 differs from pull request most recent head 94811c5. Consider uploading reports for the commit 94811c5 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev #1354 +/- ## =========================================== - Coverage 85.51% 32.11% -53.41% =========================================== Files 34 34 Lines 1940 1940 Branches 367 366 -1 =========================================== - Hits 1659 623 -1036 - Misses 211 1316 +1105 + Partials 70 1 -69 ``` | [Flag](https://app.codecov.io/gh/Azure/azure-functions-python-worker/pull/1354/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/Azure/azure-functions-python-worker/pull/1354/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure) | `32.11% <ø> (-53.36%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.