You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/06/17 14:38:53 UTC

[GitHub] [airflow] turbaszek commented on a change in pull request #9348: Properly propagated warnings in operators

turbaszek commented on a change in pull request #9348:
URL: https://github.com/apache/airflow/pull/9348#discussion_r441596706



##########
File path: tests/test_utils/mock_operators.py
##########
@@ -166,3 +166,13 @@ class MockHiveOperator(HiveOperator):
     def __init__(self, *args, **kwargs):
         self.run = mock.MagicMock()
         super().__init__(*args, **kwargs)
+
+
+class DeprecatedOperator(BaseOperator):
+    @apply_defaults
+    def __init__(self, *args, **kwargs):
+        warnings.warn("This operator is deprecated.", DeprecationWarning, stacklevel=4)

Review comment:
       The key is the `stacklevel=4`. I'm wondering how can we make sure that all deprecation warnings in operators are using the same stack level. Should we have a custom function? @potiuk @mik-laj @kaxil 




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org