codeant-ai-for-open-source[bot] commented on code in PR #39914:
URL: https://github.com/apache/superset/pull/39914#discussion_r3508327808
##########
tests/unit_tests/utils/slack_test.py:
##########
@@ -216,3 +226,192 @@ def test_handle_pagination_multiple_pages(self, mocker):
{"name": "general", "id": "C12345"},
{"name": "random", "id": "C67890"},
]
+
+
+# ---------------------------------------------------------------------------
+# should_use_v2_api: drives the v1→v2 auto-upgrade decision and emits
+# DeprecationWarning + logger.warning for both no-flag and missing-scope cases.
+# ---------------------------------------------------------------------------
+
+
[email protected](autouse=True)
+def _reset_v1_warning_caches():
Review Comment:
✅ **Customized review instruction saved!**
**Instruction:**
> Do not require return type annotations for fixtures or other functions in
test modules, since test files are exempted by the project's mypy overrides and
may intentionally remain untyped for consistency.
**Applied to:**
- `**/test/**`
- `**/tests/**`
- `**/*test*.py`
---
💡 *To manage or update this instruction, visit: [CodeAnt AI
Settings](https://app.codeant.ai/org/settings/learnings)*
##########
tests/unit_tests/utils/slack_test.py:
##########
@@ -216,3 +226,192 @@ def test_handle_pagination_multiple_pages(self, mocker):
{"name": "general", "id": "C12345"},
{"name": "random", "id": "C67890"},
]
+
+
+# ---------------------------------------------------------------------------
+# should_use_v2_api: drives the v1→v2 auto-upgrade decision and emits
+# DeprecationWarning + logger.warning for both no-flag and missing-scope cases.
+# ---------------------------------------------------------------------------
+
+
[email protected](autouse=True)
+def _reset_v1_warning_caches():
+ """Each test sees fresh once-per-process warning state.
+
+ The deprecation emitters are wrapped in `functools.cache` to give
+ thread-safe one-shot semantics in production. Tests need them to fire
+ again, so we clear the cache before and after each case.
+ """
+ _emit_v1_flag_off_deprecation.cache_clear()
+ _emit_v1_scope_missing_deprecation.cache_clear()
+ yield
+ _emit_v1_flag_off_deprecation.cache_clear()
+ _emit_v1_scope_missing_deprecation.cache_clear()
+
+
+class TestShouldUseV2Api:
Review Comment:
✅ **Customized review instruction saved!**
**Instruction:**
> Do not flag missing class docstrings in test files when the test group is
already explained by a nearby section/comment block and the repository’s
test-specific lint configuration does not require class docstrings.
**Applied to:**
- `**/test/**`
- `**/tests/**`
- `**/*test*.<ext>`
---
💡 *To manage or update this instruction, visit: [CodeAnt AI
Settings](https://app.codeant.ai/org/settings/learnings)*
##########
tests/unit_tests/utils/slack_test.py:
##########
@@ -216,3 +226,192 @@ def test_handle_pagination_multiple_pages(self, mocker):
{"name": "general", "id": "C12345"},
{"name": "random", "id": "C67890"},
]
+
+
+# ---------------------------------------------------------------------------
+# should_use_v2_api: drives the v1→v2 auto-upgrade decision and emits
+# DeprecationWarning + logger.warning for both no-flag and missing-scope cases.
+# ---------------------------------------------------------------------------
+
+
[email protected](autouse=True)
+def _reset_v1_warning_caches():
+ """Each test sees fresh once-per-process warning state.
+
+ The deprecation emitters are wrapped in `functools.cache` to give
+ thread-safe one-shot semantics in production. Tests need them to fire
+ again, so we clear the cache before and after each case.
+ """
+ _emit_v1_flag_off_deprecation.cache_clear()
+ _emit_v1_scope_missing_deprecation.cache_clear()
+ yield
+ _emit_v1_flag_off_deprecation.cache_clear()
+ _emit_v1_scope_missing_deprecation.cache_clear()
+
+
+class TestShouldUseV2Api:
+ def test_returns_true_when_flag_on_and_scopes_present(self, mocker):
Review Comment:
✅ **Customized review instruction saved!**
**Instruction:**
> Do not flag missing parameter type hints or explicit `None` return types
in Python test files under the `tests` tree; the test mypy configuration
intentionally relaxes untyped defs/calls.
**Applied to:**
- `**/test/**`
- `**/tests/**`
- `**/*test*.py`
---
💡 *To manage or update this instruction, visit: [CodeAnt AI
Settings](https://app.codeant.ai/org/settings/learnings)*
--
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]