Azure / azure-functions-python-worker

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

SettingsApi ModuleNotFoundError fix when extensions enabled #1305

Closed gavin-aguiar closed 10 months ago

gavin-aguiar commented 10 months ago

Description

Updated the try_get_sdk method to avoid popping azure.functions from sys.modules. This was causing ImportError: cannot import name 'SettingsApi' Instead now we add python_packages to sys path and then import azure.functions so that we always get the sdk from the customers library.

Other changes: Refactored dispatcher.py to improve logging.

Fixes https://github.com/Azure/azure-functions-python-worker/issues/1304


PR information

Quality of Code and Contribution Guidelines

codecov[bot] commented 10 months ago

Codecov Report

Merging #1305 (6bd4dc1) into dev (d4bdf7e) will decrease coverage by 52.86%. The diff coverage is 30.76%.

:exclamation: Current head 6bd4dc1 differs from pull request most recent head e449ff5. Consider uploading reports for the commit e449ff5 to get more accurate results

@@             Coverage Diff             @@
##              dev    #1305       +/-   ##
===========================================
- Coverage   85.00%   32.15%   -52.86%     
===========================================
  Files          34       34               
  Lines        1914     1922        +8     
  Branches      363      366        +3     
===========================================
- Hits         1627      618     -1009     
- Misses        221     1303     +1082     
+ Partials       66        1       -65     
Flag Coverage Δ
unittests 32.15% <30.76%> (-52.80%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
azure_functions_worker/dispatcher.py 19.04% <0.00%> (-69.31%) :arrow_down:
azure_functions_worker/extension.py 44.95% <ø> (-54.13%) :arrow_down:
azure_functions_worker/loader.py 31.37% <ø> (-56.25%) :arrow_down:
azure_functions_worker/logging.py 33.33% <ø> (-13.84%) :arrow_down:
azure_functions_worker/utils/common.py 32.07% <20.00%> (-67.93%) :arrow_down:
azure_functions_worker/utils/dependency.py 33.08% <80.00%> (-56.40%) :arrow_down:
azure_functions_worker/constants.py 100.00% <100.00%> (ø)

... and 17 files with indirect coverage changes