diff options
author | Alexis Hildebrandt <afh@surryhill.net> | 2023-12-06 01:44:53 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-06 01:44:53 +0000 |
commit | d270aa7b30f6cb0973467806b6b318c9fc39de47 (patch) | |
tree | d2a20d9658c3c78ca91e29e9a8343847f55c8516 /test/ConfirmTests.py | |
parent | a0bd969581a5cf3a3f88c74ba31e4764d7b24fd2 (diff) | |
parent | ecbfaa9c2e6733d516351d0a815b4cd822bfed39 (diff) | |
download | fork-ledger-d270aa7b30f6cb0973467806b6b318c9fc39de47.tar.gz fork-ledger-d270aa7b30f6cb0973467806b6b318c9fc39de47.tar.bz2 fork-ledger-d270aa7b30f6cb0973467806b6b318c9fc39de47.zip |
Merge pull request #2311 from afh/modernize-test-scripts
tests: Modernize test scripts
Diffstat (limited to 'test/ConfirmTests.py')
-rwxr-xr-x | test/ConfirmTests.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/test/ConfirmTests.py b/test/ConfirmTests.py index 0dc2b9f5..54187130 100755 --- a/test/ConfirmTests.py +++ b/test/ConfirmTests.py @@ -3,18 +3,22 @@ # This script confirms both that the register report "adds up", and that its # final balance is the same as what the balance report shows. +import argparse +import pathlib import sys import os import re from LedgerHarness import LedgerHarness -harness = LedgerHarness(sys.argv) -tests = sys.argv[3] +parser = argparse.ArgumentParser(prog='ConfirmTests', parents=[LedgerHarness.parser()]) +parser.add_argument('tests', type=pathlib.Path) +args = parser.parse_args() +harness = LedgerHarness(args.ledger, args.sourcepath, args.verify, args.gmalloc, args.python) -if not os.path.isdir(tests) and not os.path.isfile(tests): - sys.stderr.write("'%s' is not a directory or file (cwd %s)" % - (tests, os.getcwd())) +if not os.path.isdir(args.tests) and not os.path.isfile(args.tests): + print(f'{args.tests} is not a directory or file (cwd: {os.getcwd()})' + , file=sys.stderr) sys.exit(1) commands = [ @@ -86,7 +90,7 @@ def confirm_report(command): return not failure for cmd in commands: - if confirm_report('$ledger --rounding $cmd ' + re.sub('\$tests', tests, cmd)): + if confirm_report('$ledger --rounding $cmd ' + re.sub('\$tests', str(args.tests), cmd)): harness.success() else: harness.failure() |