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

Bump pytest to 8.2+ #39450

Merged
merged 2 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 dev/breeze/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ PLEASE DO NOT MODIFY THE HASH BELOW! IT IS AUTOMATICALLY UPDATED BY PRE-COMMIT.

---------------------------------------------------------------------------------------------------------

Package config hash: fdb1d2f95db1e0dba03a84a0854eb69ee931c09845071d69229e02f8ce0ffcca3da51a277a17a517119c3280a4055eee7138a6b2bba34f07f9e941f92578b67b
Package config hash: f8e8729f4236f050d4412cbbc9d53fdd4e6ddad65ce5fafd3c5b6fcdacbea5431eea760b961534a63fd5733b072b38e8167b5b0c12ee48b31c3257306ef11940

---------------------------------------------------------------------------------------------------------
4 changes: 1 addition & 3 deletions dev/breeze/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ dependencies = [
"psutil>=5.9.6",
"pygithub>=2.1.1",
"pytest-xdist>=3.3.1",
# Temporary upper limmit to <8, not all dependencies at that moment ready to use 8.0
# Internal meta-task for track https://github.com/apache/airflow/issues/37156
"pytest>=7.4.4,<8.0",
"pytest>=8.2,<9",
"pyyaml>=6.0.1",
"requests>=2.31.0",
"rich-click>=1.7.1",
Expand Down
4 changes: 1 addition & 3 deletions docker_tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Temporary upper limmit to <8, not all dependencies at that moment ready to use 8.0
# Internal meta-task for track https://github.com/apache/airflow/issues/37156
pytest>=7.4.4,<8.0
pytest>=8.2,<9
pytest-xdist
# Requests 3 if it will be released, will be heavily breaking.
requests>=2.27.0,<3
Expand Down
6 changes: 2 additions & 4 deletions hatch_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
# Coverage 7.4.0 added experimental support for Python 3.12 PEP669 which we use in Airflow
"coverage>=7.4.0",
"jmespath",
"pytest-asyncio>=0.23.3",
"pytest-asyncio>=0.23.6",
"pytest-cov>=4.1.0",
"pytest-custom-exit-code>=0.3.0",
"pytest-icdiff>=0.9",
Expand All @@ -268,9 +268,7 @@
"pytest-rerunfailures>=13.0",
"pytest-timeouts>=1.2.1",
"pytest-xdist>=3.5.0",
# Temporary upper limmit to <8, not all dependencies at that moment ready to use 8.0
# Internal meta-task for track https://github.com/apache/airflow/issues/37156
"pytest>=7.4.4,<8.0",
"pytest>=8.2,<9",
"requests_mock>=1.11.0",
"time-machine>=2.13.0",
"wheel>=0.42.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def set_env_vars():
(CONFIG_GROUP_NAME, AllBatchConfigKeys.JOB_QUEUE): "some-job-queue",
(CONFIG_GROUP_NAME, AllBatchConfigKeys.JOB_DEFINITION): "some-job-def",
(CONFIG_GROUP_NAME, AllBatchConfigKeys.MAX_SUBMIT_JOB_ATTEMPTS): "3",
(CONFIG_GROUP_NAME, AllBatchConfigKeys.CHECK_HEALTH_ON_STARTUP): "True",
}
with conf_vars(overrides):
yield
Expand Down Expand Up @@ -510,15 +511,12 @@ def test_start_success(self, set_env_vars, caplog):
batch_mock.describe_jobs.return_value = {}
executor.batch = batch_mock

caplog.set_level(logging.DEBUG)

executor.start()
caplog.clear()
with caplog.at_level(logging.DEBUG):
executor.start()

assert "succeeded" in caplog.text

@mock.patch(
"airflow.providers.amazon.aws.executors.batch.boto_schema.BatchDescribeJobsResponseSchema.load"
)
def test_health_check_failure(self, mock_executor, set_env_vars):
mock_executor.batch.describe_jobs.side_effect = Exception("Test_failure")
executor = AwsBatchExecutor()
Expand Down
2 changes: 1 addition & 1 deletion tests/providers/cncf/kubernetes/test_pod_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def test_gen_pod_extract_xcom(self, mock_rand_str, data_file):
template_file = data_file("pods/generator_base_with_secrets.yaml").as_posix()

pod_generator = PodGenerator(pod_template_file=template_file, extract_xcom=True)
with pytest.warns(AirflowProviderDeprecationWarning, match="deprecated and will be removed"):
with pytest.warns(AirflowProviderDeprecationWarning):
kaxil marked this conversation as resolved.
Show resolved Hide resolved
result = pod_generator.gen_pod()
container_two = {
"name": "airflow-xcom-sidecar",
Expand Down
8 changes: 7 additions & 1 deletion tests/utils/log/test_colored_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import pytest

from airflow.configuration import conf
from airflow.utils.log.colored_log import CustomTTYColoredFormatter

pytestmark = pytest.mark.db_test
Expand All @@ -32,7 +33,12 @@ def test_format_time_uses_tz_aware(mock_fmt):
# get a logger that uses CustomTTYColoredFormatter
logger = logging.getLogger("test_format_time")
h = logging.StreamHandler()
h.setFormatter(CustomTTYColoredFormatter())

# Explicitly pass fmt to CustomTTYColoredFormatter to avoid side effects
# from the default value being changed by other tests.
# Previously, it was being affected by tests/models/test_trigger.py::test_assign_unassigned
log_fmt = conf.get("logging", "log_format")
h.setFormatter(CustomTTYColoredFormatter(fmt=log_fmt))
logger.addHandler(h)

# verify that it uses TimezoneAware.formatTime
Expand Down