-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix test by extracting arg parsing to separate cli module that doesn'…
…t need to access seqrepo
- Loading branch information
1 parent
42ce34c
commit cead782
Showing
3 changed files
with
25 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import argparse | ||
from typing import List | ||
|
||
|
||
def parse_args(args: List[str]) -> dict: | ||
""" | ||
Parse arguments and return as dict. | ||
""" | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--filename", required=True, help="Filename to read") | ||
parser.add_argument( | ||
"--parallelism", | ||
type=int, | ||
default=1, | ||
help=( | ||
"Number of worker threads. " | ||
"Default 1, which still uses a separate process to run tasks. " | ||
"Set to 0 to run in main thread." | ||
), | ||
) | ||
return vars(parser.parse_args(args)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
from clinvar_gk_pilot.main import parse_args | ||
from clinvar_gk_pilot.cli import parse_args | ||
|
||
|
||
def test_parse_args(): | ||
argv = ["--filename", "test.txt"] | ||
opts = parse_args(argv) | ||
assert opts["filename"] == "test.txt" | ||
assert len(opts) == 1 | ||
assert opts["parallelism"] == 1 | ||
assert len(opts) == 2 |