Taragolis opened a new pull request, #38905:
URL: https://github.com/apache/airflow/pull/38905

   <!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
   
      http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
    -->
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   This PR is a result of complete rework on warning capture system:
   - Pass parameters from the pytest configurations
   - Trim path to the project root or sites
   - Keep information about original warning and in which test suite it 
originally raised
   - Avoid to use internal pytests classes
   - Output format is JSON rather than pylint (we do not use it anyway). 
Drawbacks is CI warnings summary might show greater number, it could be fixed 
as a follow up by implement simple summarised python script.
   - Output path now relative to the tests directory, but default it stored 
into the `tests/warnings.txt` regardless of the current working directory
   
   The only things the same with 
[pytest-capture-warnings](https://github.com/athinkingape/pytest-capture-warnings)
 is an idea, so I remove license headers, if some one have any objections feel 
free to ping me to return it. 
   
   **Output before**
   
   ```console
   tests/core/test_configuration.py:1411: [W0513(warning), ] The 
sql_alchemy_conn option in [core] has been moved to the sql_alchemy_conn option 
in [database] - the old setting has been used, but please update your config.
   tests/core/test_core.py:107: [W0513(warning), ] SELECT statement has a 
cartesian product between FROM element(s) "task_fail" and FROM element 
"dag_run".  Apply join condition(s) between each element to resolve.
   tests/core/test_logging_config.py:267: [W0513(warning), ] The 
`airflow.utils.log.wasb_task_handler.WasbTaskHandler` class is deprecated. 
Please use 
`'airflow.providers.microsoft.azure.log.wasb_task_handler.WasbTaskHandler'`.
   ```
   
   **Output after**
   ```console
   {"category": "DeprecationWarning", "message": "The sql_alchemy_conn option 
in [core] has been moved to the sql_alchemy_conn option in [database] - the old 
setting has been used, but please update your config.", "node_id": 
"tests/core/test_configuration.py::TestDeprecatedConf::test_conf_as_dict_when_deprecated_value_in_secrets",
 "filename": "tests/core/test_configuration.py", "lineno": 1411, "count": 1}
   {"category": "sqlalchemy.exc.SAWarning", "message": "SELECT statement has a 
cartesian product between FROM element(s) \"task_fail\" and FROM element 
\"dag_run\".  Apply join condition(s) between each element to resolve.", 
"node_id": "tests/core/test_core.py::TestCore::test_task_fail_duration", 
"filename": "tests/core/test_core.py", "lineno": 107, "count": 1}
   {"category": "DeprecationWarning", "message": "The 
`airflow.utils.log.wasb_task_handler.WasbTaskHandler` class is deprecated. 
Please use 
`'airflow.providers.microsoft.azure.log.wasb_task_handler.WasbTaskHandler'`.", 
"node_id": 
"tests/core/test_logging_config.py::TestLoggingSettings::test_loading_remote_logging_with_wasb_handler",
 "filename": "tests/core/test_logging_config.py", "lineno": 267, "count": 1}
   ```
   
   <!-- Please keep an empty line above the dashes. -->
   ---
   **^ Add meaningful description above**
   Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
 for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
 is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party 
License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in a 
newsfragment file, named `{pr_number}.significant.rst` or 
`{issue_number}.significant.rst`, in 
[newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
   


-- 
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: commits-unsubscr...@airflow.apache.org

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

Reply via email to