Skip to content

Commit

Permalink
Enable sqlalchemy.exc.RemovedIn20Warning in breeze testing by def…
Browse files Browse the repository at this point in the history
…ault (#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
  • Loading branch information
Taragolis authored Apr 18, 2024
1 parent 5a06922 commit 15eedd0
Show file tree
Hide file tree
Showing 12 changed files with 254 additions and 184 deletions.
112 changes: 62 additions & 50 deletions dev/breeze/doc/images/output_testing_db-tests.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion dev/breeze/doc/images/output_testing_db-tests.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0a5e359c1162eef2d2031801d7f8ca5d
199b411824d9e785b21d160f14dd6cd9
74 changes: 43 additions & 31 deletions dev/breeze/doc/images/output_testing_integration-tests.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion dev/breeze/doc/images/output_testing_integration-tests.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a15ab29d27810e93c440aee3972f83cc
f27636d168812ee567d9a8fe7045200c
96 changes: 52 additions & 44 deletions dev/breeze/doc/images/output_testing_non-db-tests.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion dev/breeze/doc/images/output_testing_non-db-tests.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22756189de82ee4dd8b0233ec9b6024f
76966781bf820fe7c529b1add2537097
122 changes: 67 additions & 55 deletions dev/breeze/doc/images/output_testing_tests.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion dev/breeze/doc/images/output_testing_tests.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ad4de130e1b1e608a5ef26f89ddfd969
069b0ee9765c78c2caeedd34e7ad5251
16 changes: 16 additions & 0 deletions dev/breeze/src/airflow_breeze/commands/testing_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,14 @@ def _verify_parallelism_parameters(
is_flag=True,
envvar="REMOVE_ARM_PACKAGES",
)
option_force_sa_warnings = click.option(
"--force-sa-warnings/--no-force-sa-warnings",
help="Enable `sqlalchemy.exc.MovedIn20Warning` during the tests runs.",
is_flag=True,
default=True,
show_default=True,
envvar="SQLALCHEMY_WARN_20",
)


@group_for_testing.command(
Expand Down Expand Up @@ -496,6 +504,7 @@ def _verify_parallelism_parameters(
@option_verbose
@option_dry_run
@option_github_repository
@option_force_sa_warnings
@click.argument("extra_pytest_args", nargs=-1, type=click.UNPROCESSED)
def command_for_tests(**kwargs):
_run_test_command(**kwargs)
Expand Down Expand Up @@ -537,6 +546,7 @@ def command_for_tests(**kwargs):
@option_test_timeout
@option_upgrade_boto
@option_use_airflow_version
@option_force_sa_warnings
@option_verbose
def command_for_db_tests(**kwargs):
_run_test_command(
Expand Down Expand Up @@ -585,6 +595,7 @@ def command_for_db_tests(**kwargs):
@option_test_timeout
@option_upgrade_boto
@option_use_airflow_version
@option_force_sa_warnings
@option_verbose
def command_for_non_db_tests(**kwargs):
_run_test_command(
Expand Down Expand Up @@ -612,6 +623,7 @@ def _run_test_command(
enable_coverage: bool,
excluded_parallel_test_types: str,
extra_pytest_args: tuple,
force_sa_warnings: bool,
forward_credentials: bool,
github_repository: str,
image_tag: str | None,
Expand Down Expand Up @@ -654,6 +666,7 @@ def _run_test_command(
downgrade_sqlalchemy=downgrade_sqlalchemy,
downgrade_pendulum=downgrade_pendulum,
enable_coverage=enable_coverage,
force_sa_warnings=force_sa_warnings,
forward_credentials=forward_credentials,
forward_ports=False,
github_repository=github_repository,
Expand Down Expand Up @@ -745,6 +758,7 @@ def _run_test_command(
@option_python
@option_skip_provider_tests
@option_test_timeout
@option_force_sa_warnings
@option_verbose
@click.argument("extra_pytest_args", nargs=-1, type=click.UNPROCESSED)
def integration_tests(
Expand All @@ -761,6 +775,7 @@ def integration_tests(
postgres_version: str,
python: str,
skip_provider_tests: bool,
force_sa_warnings: bool,
test_timeout: int,
):
docker_filesystem = get_filesystem_type("/var/lib/docker")
Expand All @@ -779,6 +794,7 @@ def integration_tests(
python=python,
skip_provider_tests=skip_provider_tests,
test_type="Integration",
force_sa_warnings=force_sa_warnings,
)
fix_ownership_using_docker()
cleanup_python_generated_files()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"--postgres-version",
"--mysql-version",
"--forward-credentials",
"--force-sa-warnings",
],
},
{
Expand Down Expand Up @@ -112,6 +113,7 @@
"options": [
"--python",
"--forward-credentials",
"--force-sa-warnings",
],
},
{
Expand Down Expand Up @@ -169,6 +171,7 @@
"--postgres-version",
"--mysql-version",
"--forward-credentials",
"--force-sa-warnings",
],
},
{
Expand Down Expand Up @@ -220,6 +223,7 @@
"--postgres-version",
"--mysql-version",
"--forward-credentials",
"--force-sa-warnings",
],
},
{
Expand Down
2 changes: 2 additions & 0 deletions dev/breeze/src/airflow_breeze/params/shell_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class ShellParams:
executor: str = START_AIRFLOW_DEFAULT_ALLOWED_EXECUTOR
extra_args: tuple = ()
force_build: bool = False
force_sa_warnings: bool = True
forward_credentials: bool = False
forward_ports: bool = True
github_actions: str = os.environ.get("GITHUB_ACTIONS", "false")
Expand Down Expand Up @@ -490,6 +491,7 @@ def env_variables_for_docker_commands(self) -> dict[str, str]:
_set_var(_env, "DOWNGRADE_PENDULUM", self.downgrade_pendulum)
_set_var(_env, "ENABLED_SYSTEMS", None, "")
_set_var(_env, "FLOWER_HOST_PORT", None, FLOWER_HOST_PORT)
_set_var(_env, "SQLALCHEMY_WARN_20", self.force_sa_warnings)
_set_var(_env, "GITHUB_ACTIONS", self.github_actions)
_set_var(_env, "HELM_TEST_PACKAGE", self.helm_test_package, "")
_set_var(_env, "HOST_GROUP_ID", self.host_group_id)
Expand Down
4 changes: 4 additions & 0 deletions scripts/ci/testing/summarize_captured_warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
CONSOLE_SIZE = shutil.get_terminal_size((80, 20)).columns
# Use as prefix/suffix in report output
IMPORTANT_WARNING_SIGN = {
"sqlalchemy.exc.RemovedIn20Warning": "!!!",
"sqlalchemy.exc.MovedIn20Warning": "!!!",
"sqlalchemy.exc.LegacyAPIWarning": "!!",
"sqlalchemy.exc.SAWarning": "!!",
"pydantic.warnings.PydanticDeprecatedSince20": "!!",
"celery.exceptions.CPendingDeprecationWarning": "!!",
Expand All @@ -52,7 +54,9 @@
}
# Always print messages for these warning categories
ALWAYS_SHOW_WARNINGS = {
"sqlalchemy.exc.RemovedIn20Warning",
"sqlalchemy.exc.MovedIn20Warning",
"sqlalchemy.exc.LegacyAPIWarning",
"sqlalchemy.exc.SAWarning",
"pytest.PytestWarning",
}
Expand Down

0 comments on commit 15eedd0

Please sign in to comment.