Skip to content

Commit

Permalink
add test for cli
Browse files Browse the repository at this point in the history
  • Loading branch information
inodb committed Jan 1, 2025
1 parent 6a6e895 commit 6bb5ae3
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/test_cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Test CLI

on: [push, pull_request]

jobs:
test-cli:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Install package
run: poetry install

- name: Run CLI help
run: poetry run cbiohub --help
7 changes: 4 additions & 3 deletions src/cbiohub/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,17 @@ def format_usage(self, ctx, formatter):
@click.argument("arg3", required=False)
@click.argument("arg4", required=False)
@click.argument("arg5", required=False)
def find(arg1, arg2, arg3, arg4, arg5):
@common_options
def find(arg1, arg2, arg3, arg4, arg5, processed_dir, sql):
"""Find a variant in the combined mutations parquet and return details."""
if arg1 and arg2 and arg3 and arg4:
# assuming chrom/pos/start/end
exists, unique_ids = find_variant(
chrom=arg1, start=arg2, end=arg3, ref=arg4, alt=arg5
chrom=arg1, start=arg2, end=arg3, ref=arg4, alt=arg5, directory=processed_dir
)
elif arg1 and arg2:
# assuming gene/protein_change
exists, unique_ids = find_variant(hugo_symbol=arg1, protein_change=arg2)
exists, unique_ids = find_variant(hugo_symbol=arg1, protein_change=arg2, directory=processed_dir)
else:
click.echo(click.style("❌ Invalid arguments.", fg="red"))
return
Expand Down

0 comments on commit 6bb5ae3

Please sign in to comment.