mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-18 17:33:30 -05:00
fix: refuse two output forms in diff_truth
This commit is contained in:
1 parent
b23f5b04ad
commit
6dc373fcfd
3 files changed
+30
-3
No files matched your search
@@ -168,12 +168,19 @@ def main() -> None:
|
||||
"--all", action="store_true", help="diff all registered platforms"
|
||||
)
|
||||
group.add_argument("--platform", help="diff a single platform")
|
||||
parser.add_argument(
|
||||
# One output form: --json beside --format markdown printed JSON and
|
||||
# dropped the markdown without a word.
|
||||
output = parser.add_mutually_exclusive_group()
|
||||
output.add_argument(
|
||||
"--json", action="store_true", dest="json_output", help="JSON output"
|
||||
)
|
||||
parser.add_argument(
|
||||
output.add_argument(
|
||||
"--format", choices=["terminal", "markdown"], default="terminal"
|
||||
)
|
||||
output.add_argument(
|
||||
"--markdown", action="store_const", const="markdown", dest="format",
|
||||
help="same as --format markdown, the spelling validate_pr uses",
|
||||
)
|
||||
parser.add_argument("--truth-dir", default="dist/truth")
|
||||
parser.add_argument("--platforms-dir", default="platforms")
|
||||
parser.add_argument(
|
||||
|
||||
@@ -4401,5 +4401,25 @@ class VerifyAllSummaryNamesWhatIsWrong(unittest.TestCase):
|
||||
self.assertIn("0 critical,", summary)
|
||||
|
||||
|
||||
|
||||
class OneOutputFormPerRun(unittest.TestCase):
|
||||
"""`diff_truth.py --json --format markdown` printed JSON with rc 0, the
|
||||
markdown asked for dropped without a word."""
|
||||
|
||||
def test_json_and_markdown_are_refused_together(self):
|
||||
for script, argv in (
|
||||
("diff_truth.py", ["--platform", "romm", "--json", "--format", "markdown"]),
|
||||
("diff_truth.py", ["--platform", "romm", "--json", "--markdown"]),
|
||||
("validate_pr.py", ["--json", "--markdown", "bios/Sony/PlayStation/scph5501.bin"]),
|
||||
):
|
||||
with self.subTest(script=script, argv=argv):
|
||||
proc = subprocess.run(
|
||||
[sys.executable, f"scripts/{script}", *argv], capture_output=True,
|
||||
text=True, cwd=str(ROOT), timeout=120, check=False,
|
||||
)
|
||||
self.assertEqual(proc.returncode, 2, proc.stdout[-300:])
|
||||
self.assertIn("not allowed with", proc.stderr)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
+1
-1
@@ -597,7 +597,7 @@ Further options, by script:
|
||||
| `check_freshness.py` | `--cache-dir`, `--native-cache-dir` (originals of the native export) and `--truth-dir` move the caches it reads |
|
||||
| `check_release.py` | `--tag`, `--sums dist/SHA256SUMS.txt`, `--record` (default `release.json`), `--json` |
|
||||
| `check_release_assets.py` | `--gitignore` (the asset registry), `--db`, `--notes FILE`, `--json` |
|
||||
| `diff_truth.py` | `--format markdown`, `--truth-dir`, `--target` |
|
||||
| `diff_truth.py` | `--format markdown` (or `--markdown`), `--json`, one of them; `--truth-dir`, `--target` |
|
||||
| `download.py` | `--list`, `--info <platform>` shows a pack's file name, size and parts without downloading |
|
||||
| `export_native.py` | `--truth-dir`, `--upstream-dir` (where the platforms' own files are cached) |
|
||||
| `find_pinned_revision.py` | `--repo URL --path FILE --md5 HASH`, `--write PATH`, `--cache-dir` |
|
||||
|
||||
Reference in new issue
Block a user