You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by je...@apache.org on 2021/12/08 18:03:28 UTC

[airflow] 01/05: update upper bound for MarkupSafe (#19953)

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

jedcunningham pushed a commit to branch v2-2-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 486dbae302afb307cb176464df239537ce021194
Author: Tajinder Singh <ts...@gmail.com>
AuthorDate: Mon Dec 6 09:28:14 2021 -0500

    update upper bound for MarkupSafe (#19953)
    
    Co-authored-by: Tzu-ping Chung <tp...@astronomer.io>
    (cherry picked from commit ba6b7c7424f6b5ea2c1464304be8738ea482f8c1)
---
 setup.cfg                              |  2 +-
 tests/www/views/test_views_rendered.py | 18 +++++++++++-------
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/setup.cfg b/setup.cfg
index e234a04..ff95f29 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -122,7 +122,7 @@ install_requires =
     lazy-object-proxy
     lockfile>=0.12.2
     markdown>=2.5.2, <4.0
-    markupsafe>=1.1.1, <2.0
+    markupsafe>=1.1.1, <=2.0
     marshmallow-oneofschema>=2.0.1
     # Required by vendored-in connexion
     openapi-spec-validator>=0.2.4
diff --git a/tests/www/views/test_views_rendered.py b/tests/www/views/test_views_rendered.py
index b749fa1..f88db34 100644
--- a/tests/www/views/test_views_rendered.py
+++ b/tests/www/views/test_views_rendered.py
@@ -28,7 +28,7 @@ from airflow.utils.session import create_session
 from airflow.utils.state import DagRunState, TaskInstanceState
 from airflow.utils.types import DagRunType
 from tests.test_utils.db import clear_db_dags, clear_db_runs, clear_rendered_ti_fields
-from tests.test_utils.www import check_content_in_response, check_content_not_in_response
+from tests.test_utils.www import check_content_in_response
 
 DEFAULT_DATE = timezone.datetime(2020, 3, 1)
 
@@ -154,13 +154,17 @@ def test_user_defined_filter_and_macros_raise_error(admin_client, create_dag_run
     url = f'rendered-templates?task_id=task2&dag_id=testdag&execution_date={quote_plus(str(DEFAULT_DATE))}'
 
     resp = admin_client.get(url, follow_redirects=True)
+    assert resp.status_code == 200
 
-    check_content_not_in_response("echo Hello Apache Airflow", resp)
-    check_content_in_response(
+    resp_html: str = resp.data.decode("utf-8")
+    assert "echo Hello Apache Airflow" in resp_html
+    assert (
         "Webserver does not have access to User-defined Macros or Filters when "
         "Dag Serialization is enabled. Hence for the task that have not yet "
         "started running, please use &#39;airflow tasks render&#39; for "
-        "debugging the rendering of template_fields.<br><br>OriginalError: no "
-        "filter named &#39;hello&#39",
-        resp,
-    )
+        "debugging the rendering of template_fields.<br><br>"
+    ) in resp_html
+
+    # MarkupSafe changed the exception detail from 'no filter named' to
+    # 'No filter named' in 2.0 (I think), so we normalize for comparison.
+    assert "originalerror: no filter named &#39;hello&#39;" in resp_html.lower()