eschutho opened a new pull request, #42086:
URL: https://github.com/apache/superset/pull/42086

   ## Summary
   
   Flask-AppBuilder's `AppBuilder.app` property is deprecated (`appbuilder.app 
is deprecated and will be removed in a future version. Use current_app 
instead`), and every call site was migrated to `current_app` in #40876 — except 
one that slipped through: 
`tests/integration_tests/views/test_explore_redirect.py`'s 
`test_explore_root_owns_bare_path`, which still did:
   
   ```python
   from superset.extensions import appbuilder
   adapter = appbuilder.app.url_map.bind("")
   ```
   
   This fires the deprecation warning (`superset.extensions.appbuilder`'s `app` 
property, `flask_appbuilder/base.py`) every time the test runs, and shows up 
repeatedly as log noise (Datadog `deprecat*` search) since flask-appbuilder 
logs at `WARNING` regardless of caller.
   
   ## Change
   
   Swapped the deprecated property access for `current_app` (imported from 
`flask`), mirroring the exact substitution pattern #40876 used elsewhere (e.g. 
`superset/initialization/__init__.py`):
   
   ```python
   from flask import current_app
   ...
   adapter = current_app.url_map.bind("")
   ```
   
   ## No behavior change
   
   `AppBuilder.app`'s implementation is just:
   ```python
   @property
   def app(self) -> Flask:
       log.warning(...)
       return current_app
   ```
   So `current_app` is the identical object the old property returned, minus 
the warning. `current_app.url_map.bind("")` produces the same `MapAdapter` 
bound to the same Flask app.
   
   Confirmed via `git grep -n 'appbuilder\.app\b'` that no other real 
(non-comment) usages remain in the repo.
   
   ## Test plan
   
   - `pytest tests/integration_tests/views/test_explore_redirect.py` — all 16 
tests pass, and the `appbuilder.app is deprecated` warning no longer appears in 
output.
   - `ruff check` / `ruff format --check` clean; pre-commit clean.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to