Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of pytest-httpx as dependency #37334

Merged
merged 1 commit into from
Feb 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,7 @@ COPY --from=scripts install_from_docker_context_files.sh install_airflow.sh \
# an incorrect architecture.
ARG TARGETARCH
# Value to be able to easily change cache id and therefore use a bare new cache
ARG PIP_CACHE_EPOCH="0"
ARG PIP_CACHE_EPOCH="9"

# hadolint ignore=SC2086, SC2010, DL3042
RUN --mount=type=cache,id=$PYTHON_BASE_IMAGE-$AIRFLOW_PIP_VERSION-$TARGETARCH-$PIP_CACHE_EPOCH,target=/tmp/.cache/pip,uid=${AIRFLOW_UID} \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@ ARG AIRFLOW_CONSTRAINTS_LOCATION=""
ARG DEFAULT_CONSTRAINTS_BRANCH="constraints-main"
# By changing the epoch we can force reinstalling Airflow and pip all dependencies
# It can also be overwritten manually by setting the AIRFLOW_CI_BUILD_EPOCH environment variable.
ARG AIRFLOW_CI_BUILD_EPOCH="6"
ARG AIRFLOW_CI_BUILD_EPOCH="7"
ARG AIRFLOW_PRE_CACHED_PIP_PACKAGES="true"
ARG AIRFLOW_PIP_VERSION=24.0
# Setup PIP
Expand Down
2 changes: 1 addition & 1 deletion airflow/providers/databricks/provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ versions:
dependencies:
- apache-airflow>=2.6.0
- apache-airflow-providers-common-sql>=1.10.0
- requests>=2.27,<3
- requests>=2.27.0,<3
potiuk marked this conversation as resolved.
Show resolved Hide resolved
# The connector 2.9.0 released on Aug 10, 2023 has a bug that it does not properly declare urllib3 and
# it needs to be excluded. See https://github.com/databricks/databricks-sql-python/issues/190
# The 2.9.1 (to be released soon) already contains the fix
Expand Down
2 changes: 1 addition & 1 deletion airflow/providers/http/provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dependencies:
- apache-airflow>=2.6.0
# The 2.26.0 release of requests got rid of the chardet LGPL mandatory dependency, allowing us to
# release it as a requirement for airflow
- requests>=2.26.0
- requests>=2.27.0,<3
- requests_toolbelt
- aiohttp>=3.9.2
- asgiref
Expand Down
2 changes: 1 addition & 1 deletion airflow/providers/influxdb/provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ description: |
dependencies:
- apache-airflow>=2.6.0
- influxdb-client>=1.19.0
- requests>=2.26.0
- requests>=2.27.0,<3

state: ready
source-date-epoch: 1703288143
Expand Down
6 changes: 3 additions & 3 deletions generated/provider_dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@
"apache-airflow-providers-common-sql>=1.10.0",
"apache-airflow>=2.6.0",
"databricks-sql-connector>=2.0.0, <3.0.0, !=2.9.0",
"requests>=2.27,<3"
"requests>=2.27.0,<3"
],
"devel-deps": [
"deltalake>=0.12.0"
Expand Down Expand Up @@ -618,7 +618,7 @@
"aiohttp>=3.9.2",
"apache-airflow>=2.6.0",
"asgiref",
"requests>=2.26.0",
"requests>=2.27.0,<3",
"requests_toolbelt"
],
"devel-deps": [],
Expand All @@ -639,7 +639,7 @@
"deps": [
"apache-airflow>=2.6.0",
"influxdb-client>=1.19.0",
"requests>=2.26.0"
"requests>=2.27.0,<3"
],
"devel-deps": [],
"cross-providers-deps": [],
Expand Down
11 changes: 6 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ dependencies = [
"python-dateutil>=2.3",
"python-nvd3>=0.15.0",
"python-slugify>=5.0",
# Requests 3 if it will be released, will be heavily breaking.
"requests>=2.27.0,<3",
"rfc3339-validator>=0.1.4",
"rich-argparse>=1.0.0",
"rich>=12.4.4",
Expand Down Expand Up @@ -185,7 +187,7 @@ cgroups = [
"cgroupspy>=0.2.2",
]
deprecated-api = [
"requests>=2.26.0",
"requests>=2.27.0,<3",
]
github-enterprise = [
"apache-airflow[fab]",
Expand Down Expand Up @@ -340,7 +342,6 @@ devel-tests = [
"coverage>=7.2",
"pytest-asyncio>=0.23.3",
"pytest-cov>=4.1.0",
"pytest-httpx>=0.21.3",
potiuk marked this conversation as resolved.
Show resolved Hide resolved
"pytest-icdiff>=0.9",
"pytest-instafail>=0.5.0",
"pytest-mock>=3.12.0",
Expand Down Expand Up @@ -654,7 +655,7 @@ databricks = [ # source: airflow/providers/databricks/provider.yaml
"aiohttp>=3.9.2, <4",
"apache-airflow[common_sql]",
"databricks-sql-connector>=2.0.0, <3.0.0, !=2.9.0",
"requests>=2.27,<3",
"requests>=2.27.0,<3",
# Devel dependencies for the databricks provider
"deltalake>=0.12.0",
]
Expand Down Expand Up @@ -769,13 +770,13 @@ hashicorp = [ # source: airflow/providers/hashicorp/provider.yaml
http = [ # source: airflow/providers/http/provider.yaml
"aiohttp>=3.9.2",
"asgiref",
"requests>=2.26.0",
"requests>=2.27.0,<3",
"requests_toolbelt",
]
imap = [] # source: airflow/providers/imap/provider.yaml
influxdb = [ # source: airflow/providers/influxdb/provider.yaml
"influxdb-client>=1.19.0",
"requests>=2.26.0",
"requests>=2.27.0,<3",
]
jdbc = [ # source: airflow/providers/jdbc/provider.yaml
"apache-airflow[common_sql]",
Expand Down
31 changes: 16 additions & 15 deletions tests/cli/commands/test_info_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
import logging
import os
from io import StringIO
from unittest import mock

import httpx
import pytest
from rich.console import Console

Expand Down Expand Up @@ -181,18 +183,17 @@ class TestInfoCommandMockHttpx:
("database", "sql_alchemy_conn"): "postgresql+psycopg2://postgres:airflow@postgres/airflow",
}
)
def test_show_info_anonymize_fileio(self, httpx_mock, setup_parser):
httpx_mock.add_response(
url="https://file.io",
method="post",
json={
"success": True,
"key": "f9U3zs3I",
"link": "https://file.io/TEST",
"expiry": "14 days",
},
status_code=200,
)
with contextlib.redirect_stdout(StringIO()) as stdout:
info_command.show_info(setup_parser.parse_args(["info", "--file-io"]))
assert "https://file.io/TEST" in stdout.getvalue()
def test_show_info_anonymize_fileio(self, setup_parser):
with mock.patch("airflow.cli.commands.info_command.httpx.post") as post:
post.return_value = httpx.Response(
status_code=200,
json={
"success": True,
"key": "f9U3zs3I",
"link": "https://file.io/TEST",
"expiry": "14 days",
},
)
with contextlib.redirect_stdout(StringIO()) as stdout:
info_command.show_info(setup_parser.parse_args(["info", "--file-io", "--anonymize"]))
assert "https://file.io/TEST" in stdout.getvalue()