This is an automated email from the ASF dual-hosted git repository.
Lee-W pushed a commit to branch v3-3-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-3-test by this push:
new fee0aac6967 [v3-3-test] Make cheat-sheet test independent of rich
table padding (#69802) (#69892)
fee0aac6967 is described below
commit fee0aac696727e6dc4434f900d39344ff2b28cb8
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Jul 15 16:55:07 2026 +0800
[v3-3-test] Make cheat-sheet test independent of rich table padding
(#69802) (#69892)
(cherry picked from commit fc51ac92017b154d76ca6e8ffa23a2a382e33ec7)
Signed-off-by: PoAn Yang <[email protected]>
Co-authored-by: PoAn Yang <[email protected]>
---
.../unit/cli/commands/test_cheat_sheet_command.py | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/airflow-core/tests/unit/cli/commands/test_cheat_sheet_command.py
b/airflow-core/tests/unit/cli/commands/test_cheat_sheet_command.py
index b00bb560593..5c4baa8d807 100644
--- a/airflow-core/tests/unit/cli/commands/test_cheat_sheet_command.py
+++ b/airflow-core/tests/unit/cli/commands/test_cheat_sheet_command.py
@@ -16,6 +16,7 @@
# under the License.
from __future__ import annotations
+import re
from unittest import mock
from airflow.cli import cli_parser
@@ -72,20 +73,25 @@ MOCK_COMMANDS: list[CLICommand] = [
]
ALL_COMMANDS = """\
-airflow cmd_b | Help text D
+airflow cmd_b | Help text D
"""
SECTION_A = """\
-airflow cmd_a cmd_b | Help text B
-airflow cmd_a cmd_c | Help text C
+airflow cmd_a cmd_b | Help text B
+airflow cmd_a cmd_c | Help text C
"""
SECTION_E = """\
-airflow cmd_e cmd_f | Help text F
-airflow cmd_e cmd_g | Help text G
+airflow cmd_e cmd_f | Help text F
+airflow cmd_e cmd_g | Help text G
"""
+def normalize_spaces(text: str) -> str:
+ """Collapse runs of spaces so assertions do not depend on the rich
version's exact column padding."""
+ return re.sub(r" +", " ", text)
+
+
class TestCheatSheetCommand:
@classmethod
def setup_class(cls):
@@ -96,7 +102,7 @@ class TestCheatSheetCommand:
with stdout_capture as temp_stdout:
args = self.parser.parse_args(["cheat-sheet"])
args.func(args)
- output = temp_stdout.getvalue()
+ output = normalize_spaces(temp_stdout.getvalue())
assert ALL_COMMANDS in output
assert SECTION_A in output
assert SECTION_E in output