Skip to content

Commit 15eedd0

Browse files
authored
Enable sqlalchemy.exc.RemovedIn20Warning in breeze testing by default (#39121)
* Enable `sqlalchemy.exc.RemovedIn20Warning` in `breeze testing` by default * Mark `sqlalchemy.exc.RemovedIn20Warning` as important during finalize warnings * Also mark `sqlalchemy.exc.LegacyAPIWarning` as important during finalize warnings
1 parent 5a06922 commit 15eedd0

12 files changed

+254
-184
lines changed

dev/breeze/doc/images/output_testing_db-tests.svg

+62-50
Loading
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0a5e359c1162eef2d2031801d7f8ca5d
1+
199b411824d9e785b21d160f14dd6cd9

dev/breeze/doc/images/output_testing_integration-tests.svg

+43-31
Loading
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
a15ab29d27810e93c440aee3972f83cc
1+
f27636d168812ee567d9a8fe7045200c

dev/breeze/doc/images/output_testing_non-db-tests.svg

+52-44
Loading
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
22756189de82ee4dd8b0233ec9b6024f
1+
76966781bf820fe7c529b1add2537097

dev/breeze/doc/images/output_testing_tests.svg

+67-55
Loading
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ad4de130e1b1e608a5ef26f89ddfd969
1+
069b0ee9765c78c2caeedd34e7ad5251

dev/breeze/src/airflow_breeze/commands/testing_commands.py

+16
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,14 @@ def _verify_parallelism_parameters(
450450
is_flag=True,
451451
envvar="REMOVE_ARM_PACKAGES",
452452
)
453+
option_force_sa_warnings = click.option(
454+
"--force-sa-warnings/--no-force-sa-warnings",
455+
help="Enable `sqlalchemy.exc.MovedIn20Warning` during the tests runs.",
456+
is_flag=True,
457+
default=True,
458+
show_default=True,
459+
envvar="SQLALCHEMY_WARN_20",
460+
)
453461

454462

455463
@group_for_testing.command(
@@ -496,6 +504,7 @@ def _verify_parallelism_parameters(
496504
@option_verbose
497505
@option_dry_run
498506
@option_github_repository
507+
@option_force_sa_warnings
499508
@click.argument("extra_pytest_args", nargs=-1, type=click.UNPROCESSED)
500509
def command_for_tests(**kwargs):
501510
_run_test_command(**kwargs)
@@ -537,6 +546,7 @@ def command_for_tests(**kwargs):
537546
@option_test_timeout
538547
@option_upgrade_boto
539548
@option_use_airflow_version
549+
@option_force_sa_warnings
540550
@option_verbose
541551
def command_for_db_tests(**kwargs):
542552
_run_test_command(
@@ -585,6 +595,7 @@ def command_for_db_tests(**kwargs):
585595
@option_test_timeout
586596
@option_upgrade_boto
587597
@option_use_airflow_version
598+
@option_force_sa_warnings
588599
@option_verbose
589600
def command_for_non_db_tests(**kwargs):
590601
_run_test_command(
@@ -612,6 +623,7 @@ def _run_test_command(
612623
enable_coverage: bool,
613624
excluded_parallel_test_types: str,
614625
extra_pytest_args: tuple,
626+
force_sa_warnings: bool,
615627
forward_credentials: bool,
616628
github_repository: str,
617629
image_tag: str | None,
@@ -654,6 +666,7 @@ def _run_test_command(
654666
downgrade_sqlalchemy=downgrade_sqlalchemy,
655667
downgrade_pendulum=downgrade_pendulum,
656668
enable_coverage=enable_coverage,
669+
force_sa_warnings=force_sa_warnings,
657670
forward_credentials=forward_credentials,
658671
forward_ports=False,
659672
github_repository=github_repository,
@@ -745,6 +758,7 @@ def _run_test_command(
745758
@option_python
746759
@option_skip_provider_tests
747760
@option_test_timeout
761+
@option_force_sa_warnings
748762
@option_verbose
749763
@click.argument("extra_pytest_args", nargs=-1, type=click.UNPROCESSED)
750764
def integration_tests(
@@ -761,6 +775,7 @@ def integration_tests(
761775
postgres_version: str,
762776
python: str,
763777
skip_provider_tests: bool,
778+
force_sa_warnings: bool,
764779
test_timeout: int,
765780
):
766781
docker_filesystem = get_filesystem_type("/var/lib/docker")
@@ -779,6 +794,7 @@ def integration_tests(
779794
python=python,
780795
skip_provider_tests=skip_provider_tests,
781796
test_type="Integration",
797+
force_sa_warnings=force_sa_warnings,
782798
)
783799
fix_ownership_using_docker()
784800
cleanup_python_generated_files()

dev/breeze/src/airflow_breeze/commands/testing_commands_config.py

+4
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"--postgres-version",
5757
"--mysql-version",
5858
"--forward-credentials",
59+
"--force-sa-warnings",
5960
],
6061
},
6162
{
@@ -112,6 +113,7 @@
112113
"options": [
113114
"--python",
114115
"--forward-credentials",
116+
"--force-sa-warnings",
115117
],
116118
},
117119
{
@@ -169,6 +171,7 @@
169171
"--postgres-version",
170172
"--mysql-version",
171173
"--forward-credentials",
174+
"--force-sa-warnings",
172175
],
173176
},
174177
{
@@ -220,6 +223,7 @@
220223
"--postgres-version",
221224
"--mysql-version",
222225
"--forward-credentials",
226+
"--force-sa-warnings",
223227
],
224228
},
225229
{

dev/breeze/src/airflow_breeze/params/shell_params.py

+2
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ class ShellParams:
142142
executor: str = START_AIRFLOW_DEFAULT_ALLOWED_EXECUTOR
143143
extra_args: tuple = ()
144144
force_build: bool = False
145+
force_sa_warnings: bool = True
145146
forward_credentials: bool = False
146147
forward_ports: bool = True
147148
github_actions: str = os.environ.get("GITHUB_ACTIONS", "false")
@@ -490,6 +491,7 @@ def env_variables_for_docker_commands(self) -> dict[str, str]:
490491
_set_var(_env, "DOWNGRADE_PENDULUM", self.downgrade_pendulum)
491492
_set_var(_env, "ENABLED_SYSTEMS", None, "")
492493
_set_var(_env, "FLOWER_HOST_PORT", None, FLOWER_HOST_PORT)
494+
_set_var(_env, "SQLALCHEMY_WARN_20", self.force_sa_warnings)
493495
_set_var(_env, "GITHUB_ACTIONS", self.github_actions)
494496
_set_var(_env, "HELM_TEST_PACKAGE", self.helm_test_package, "")
495497
_set_var(_env, "HOST_GROUP_ID", self.host_group_id)

scripts/ci/testing/summarize_captured_warnings.py

+4
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@
4141
CONSOLE_SIZE = shutil.get_terminal_size((80, 20)).columns
4242
# Use as prefix/suffix in report output
4343
IMPORTANT_WARNING_SIGN = {
44+
"sqlalchemy.exc.RemovedIn20Warning": "!!!",
4445
"sqlalchemy.exc.MovedIn20Warning": "!!!",
46+
"sqlalchemy.exc.LegacyAPIWarning": "!!",
4547
"sqlalchemy.exc.SAWarning": "!!",
4648
"pydantic.warnings.PydanticDeprecatedSince20": "!!",
4749
"celery.exceptions.CPendingDeprecationWarning": "!!",
@@ -52,7 +54,9 @@
5254
}
5355
# Always print messages for these warning categories
5456
ALWAYS_SHOW_WARNINGS = {
57+
"sqlalchemy.exc.RemovedIn20Warning",
5558
"sqlalchemy.exc.MovedIn20Warning",
59+
"sqlalchemy.exc.LegacyAPIWarning",
5660
"sqlalchemy.exc.SAWarning",
5761
"pytest.PytestWarning",
5862
}

0 commit comments

Comments
 (0)