Skip to content

Commit

Permalink
Merge branch 'master' of github.com:wfondrie/ppx
Browse files Browse the repository at this point in the history
  • Loading branch information
wfondrie committed Nov 23, 2021
2 parents 502f1fc + e823cb9 commit 0c758f6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
24 changes: 18 additions & 6 deletions ppx/ppx.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@

def get_parser():
"""Parse the command line arguments"""
desc = f"""
ppx version {__version__}. Use this command line utility to download
files from the PRIDE and MassIVE proteomics repositories. The paths
to the downloaded files are written to stdout.
"""
desc = f"""Use this command line utility to download files from the PRIDE and MassIVE
proteomics repositories. The paths to the downloaded files are written to
stdout."""

epilog = "More documentation and examples at: https://ppx.readthedocs.io"
parser = ArgumentParser(description=desc, epilog=epilog)
Expand Down Expand Up @@ -55,6 +53,13 @@ def get_parser():
),
)

parser.add_argument(
"-t",
"--timeout",
type=float,
help="The maximum amount of time to wait for a server response.",
)

parser.add_argument(
"-f",
"--force",
Expand All @@ -66,6 +71,13 @@ def get_parser():
),
)

parser.add_argument(
"--version",
action="version",
help="Get the version of ppx.",
version="%(prog)s " + __version__,
)

return parser


Expand All @@ -77,7 +89,7 @@ def main():

parser = get_parser()
args = parser.parse_args()
proj = find_project(args.identifier, args.local)
proj = find_project(args.identifier, args.local, timeout=args.timeout)
remote_files = proj.remote_files()

if len(args.files) > 0:
Expand Down
7 changes: 6 additions & 1 deletion tests/system_tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
def test_pride(tmp_path):
"""Test the CLI for pride"""
out_dir = tmp_path / PXID
cmd = ["ppx", "-l", str(out_dir), PXID, "*.txt"]
cmd = ["ppx", "-l", str(out_dir), "-t", "10", PXID, "*.txt"]
subprocess.run(cmd, check=True)
print(list(out_dir.iterdir()))

Expand All @@ -23,3 +23,8 @@ def test_massive(tmp_path):
cmd = ["ppx", "-l", str(out_dir), MSVID, "*/statistics.tsv"]
subprocess.run(cmd, check=True)
assert (out_dir / "ccms_statistics" / "statistics.tsv").exists()


def test_version(tmp_path):
"""Test ppx version"""
subprocess.run(["ppx", "--version"], check=True)

0 comments on commit 0c758f6

Please sign in to comment.