Remove outdated test for CLI program name and version number
Marco Ricci

Marco Ricci commited on 2025-08-09 19:04:38
Zeige 2 geänderte Dateien mit 16 Einfügungen und 30 Löschungen.


The more exhaustive `--version` output parsing tests already assert that
the program name and version number match their expected values.  There
is no point in separately testing this.
... ...
@@ -702,36 +702,6 @@ class TestCLI:
702 702
             empty_stderr=True, output="Use $VISUAL or $EDITOR to configure"
703 703
         ), "expected clean exit, and option group epilog in help text"
704 704
 
705
-    # TODO(the-13th-letter): Remove this test once
706
-    # TestAllCLI.test_202_version_option_output no longer xfails.
707
-    def test_200a_version_output(
708
-        self,
709
-    ) -> None:
710
-        """The `--version` option emits version information."""
711
-        runner = machinery.CliRunner(mix_stderr=False)
712
-        # TODO(the-13th-letter): Rewrite using parenthesized
713
-        # with-statements.
714
-        # https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9
715
-        with contextlib.ExitStack() as stack:
716
-            monkeypatch = stack.enter_context(pytest.MonkeyPatch.context())
717
-            stack.enter_context(
718
-                pytest_machinery.isolated_config(
719
-                    monkeypatch=monkeypatch,
720
-                    runner=runner,
721
-                )
722
-            )
723
-            result = runner.invoke(
724
-                cli.derivepassphrase_vault,
725
-                ["--version"],
726
-                catch_exceptions=False,
727
-            )
728
-        assert result.clean_exit(empty_stderr=True, output=cli.PROG_NAME), (
729
-            "expected clean exit, and program name in version text"
730
-        )
731
-        assert result.clean_exit(empty_stderr=True, output=cli.VERSION), (
732
-            "expected clean exit, and version in help text"
733
-        )
734
-
735 705
     @Parametrize.CHARSET_NAME
736 706
     def test_201_disable_character_set(
737 707
         self,
... ...
@@ -581,6 +581,10 @@ class TestAllCLI:
581 581
         the known and supported derivation schemes, and a list of
582 582
         subcommands.
583 583
 
584
+        As a side effect, [`parse_version_output`][] guarantees that the
585
+        first line contains both the correct program name as well as the
586
+        correct program version number.
587
+
584 588
         """
585 589
         runner = machinery.CliRunner(mix_stderr=False)
586 590
         # TODO(the-13th-letter): Rewrite using parenthesized
... ...
@@ -622,6 +626,10 @@ class TestAllCLI:
622 626
         configuration formats (but not marked as supported), and a list
623 627
         of subcommands.
624 628
 
629
+        As a side effect, [`parse_version_output`][] guarantees that the
630
+        first line contains both the correct program name as well as the
631
+        correct program version number.
632
+
625 633
         """
626 634
         runner = machinery.CliRunner(mix_stderr=False)
627 635
         # TODO(the-13th-letter): Rewrite using parenthesized
... ...
@@ -670,6 +678,10 @@ class TestAllCLI:
670 678
         vault-specific subset of the known or supported foreign
671 679
         configuration formats, and a list of available PEP 508 extras.
672 680
 
681
+        As a side effect, [`parse_version_output`][] guarantees that the
682
+        first line contains both the correct program name as well as the
683
+        correct program version number.
684
+
673 685
         """
674 686
         runner = machinery.CliRunner(mix_stderr=False)
675 687
         # TODO(the-13th-letter): Rewrite using parenthesized
... ...
@@ -725,6 +737,10 @@ class TestAllCLI:
725 737
         vault command, the output should not contain anything beyond the
726 738
         first paragraph.
727 739
 
740
+        As a side effect, [`parse_version_output`][] guarantees that the
741
+        first line contains both the correct program name as well as the
742
+        correct program version number.
743
+
728 744
         """
729 745
         runner = machinery.CliRunner(mix_stderr=False)
730 746
         # TODO(the-13th-letter): Rewrite using parenthesized
731 747