Lee-W commented on code in PR #43383:
URL: https://github.com/apache/airflow/pull/43383#discussion_r1940563339


##########
tests/utils/test_preexisting_python_virtualenv_decorator.py:
##########
@@ -17,25 +17,66 @@
 # under the License.
 from __future__ import annotations
 
+from textwrap import dedent
+
+import pytest
+
 from airflow.utils.decorators import remove_task_decorator
 
 
 class TestExternalPythonDecorator:
     def test_remove_task_decorator(self):

Review Comment:
   same refactor can be done here



##########
providers/standard/tests/provider_tests/standard/utils/test_python_virtualenv.py:
##########
@@ -192,25 +193,77 @@ def 
test_should_create_virtualenv_with_extra_packages_uv(self, mock_execute_in_s
         )
 
     def test_remove_task_decorator(self):

Review Comment:
   nits: we probably could refactor these cases through 
`pytest.mark.parametrize` (remember to use id to make it more readable)



##########
airflow/utils/decorators.py:
##########
@@ -18,54 +18,55 @@
 from __future__ import annotations
 
 import sys
-from collections import deque
 from typing import Callable, TypeVar
 
+import libcst as cst
+
 T = TypeVar("T", bound=Callable)
 
 
+class _TaskDecoratorRemover(cst.CSTTransformer):
+    def __init__(self, task_decorator_name):
+        self.decorators_to_remove = {
+            "setup",
+            "teardown",
+            "task.skip_if",
+            "task.run_if",
+            task_decorator_name.strip("@"),
+        }
+
+    def _is_task_decorator(self, decorator: cst.Decorator) -> bool:

Review Comment:
   @josix this one is missed



-- 
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]

Reply via email to