Skip to content

Commit

Permalink
- adjusted arguments parser to enforce directory arguments being
Browse files Browse the repository at this point in the history
  directories;
  • Loading branch information
jaltmayerpizzorno committed Feb 27, 2024
1 parent b760899 commit c5c64c2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/coverup/coverup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,15 @@ def parse_args(args=None):
ap.add_argument('source_files', type=Path, nargs='*',
help='only process certain source file(s)')

ap.add_argument('--tests-dir', type=Path, required=True,
def Path_dir(value):
path_dir = Path(value)
if not path_dir.is_dir(): raise argparse.ArgumentTypeError("must be a directory")
return path_dir

ap.add_argument('--tests-dir', type=Path_dir, required=True,
help='directory where tests reside')

ap.add_argument('--source-dir', '--source', type=Path, required=True,
ap.add_argument('--source-dir', '--source', type=Path_dir, required=True,
help='directory where sources reside')

ap.add_argument('--checkpoint', type=Path,
Expand Down Expand Up @@ -92,7 +97,6 @@ def positive_int(value):

return ap.parse_args(args)


def test_file_path(test_seq: int) -> Path:
"""Returns the Path for a test's file, given its sequence number."""
return args.tests_dir / f"test_{PREFIX}_{test_seq}.py"
Expand Down

0 comments on commit c5c64c2

Please sign in to comment.