You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2023/02/12 14:32:27 UTC

[airflow] branch main updated: Fix failing multiple-output-inference tests for Python 3.8+ (#29489)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 7505847d66 Fix failing multiple-output-inference tests for Python 3.8+ (#29489)
7505847d66 is described below

commit 7505847d6622e7c30e0447c5ae57e470ee8e812e
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Sun Feb 12 15:32:09 2023 +0100

    Fix failing multiple-output-inference tests for Python 3.8+ (#29489)
    
    The #29445 introduced a test for generated warnings that tested
    line number of the generated warning. However the number of line
    had changed in Python 3.8 because the stack trace of the error
    is a bit different.
    
    The #29445 tests passed when merging as they were only run for
    Python 3.7, however our Canary builds caught it and failed in main.
    
    Adding conditionals to handle it for other Python versions as well.
---
 tests/decorators/test_python.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/decorators/test_python.py b/tests/decorators/test_python.py
index 7ef6903e5a..4db7d2f447 100644
--- a/tests/decorators/test_python.py
+++ b/tests/decorators/test_python.py
@@ -22,6 +22,7 @@ from typing import TYPE_CHECKING, Dict, Tuple
 
 import pytest
 
+from airflow import PY38
 from airflow.decorators import task as task_decorator
 from airflow.decorators.base import DecoratedMappedOperator
 from airflow.exceptions import AirflowException
@@ -118,7 +119,7 @@ class TestAirflowTaskDecorator(BasePythonTest):
             ) -> "UnresolveableName[int, int]":
                 ...
 
-            line = sys._getframe().f_lineno - 3
+            line = sys._getframe().f_lineno - 6 if PY38 else sys._getframe().f_lineno - 3
 
         warn = recwarn[0]
         assert warn.filename == __file__