diff --git a/test/cmdline_tests.sh b/test/cmdline_tests.sh index a4d58038..317d9c4a 100755 --- a/test/cmdline_tests.sh +++ b/test/cmdline_tests.sh @@ -25,13 +25,15 @@ if [ $# -eq 0 ]; then # use default example location EXDATADIR="example-files" BEAGLEDIR="trtools/testsupport/sample_vcfs/beagle" -elif (( $# != 2 )) ; then - echo "usage: cmdline_tests.sh {example_dir} {beagle_dir}" 2>&1 - echo "Expected 2 arguments but recieved $#" 2>&1 + BEAGLESCRIPT="scripts/trtools_prep_beagle_vcf.sh" +elif (( $# != 3 )) ; then + echo "usage: cmdline_tests.sh {example_dir} {beagle_dir} {beagle_script}" 2>&1 + echo "Expected 3 arguments but recieved $#" 2>&1 exit 1 else EXDATADIR=$1 BEAGLEDIR=$2 + BEAGLESCRIPT=$3 fi TMPDIR=$(mktemp -d -t tmp-XXXXXXXXXX) @@ -220,10 +222,10 @@ prep_beagle_out="$TMPDIR"/test_prep_beagle_vcf.vcf.gz ref_panel="$BEAGLEDIR"/1kg_snpstr_21_first_100k_first_50_annotated.vcf.gz imputed_vcf="$BEAGLEDIR"/1kg_snpstr_21_first_100k_second_50_STRs_imputed.vcf.gz -runcmd_fail "trtools_prep_beagle_vcf.sh hipstr nonexistent.vcf.gz $imputed_vcf $prep_beagle_out" -runcmd_fail "trtools_prep_beagle_vcf.sh hipstr $ref_panel nonexistent.vcf.gz $prep_beagle_out" +runcmd_fail "$BEAGLESCRIPT hipstr nonexistent.vcf.gz $imputed_vcf $prep_beagle_out" +runcmd_fail "$BEAGLESCRIPT hipstr $ref_panel nonexistent.vcf.gz $prep_beagle_out" -trtools_prep_beagle_vcf.sh hipstr "$ref_panel" "$imputed_vcf" "$prep_beagle_out" +$BEAGLESCRIPT hipstr "$ref_panel" "$imputed_vcf" "$prep_beagle_out" if ! [[ -f "$prep_beagle_out" ]] ; then echo "prep_beagle_vcf test didn't produce output file" >&2 diff --git a/trtools/testsupport/test_trtools.sh b/trtools/testsupport/test_trtools.sh index 67eb46d5..36ff2159 100755 --- a/trtools/testsupport/test_trtools.sh +++ b/trtools/testsupport/test_trtools.sh @@ -2,7 +2,13 @@ # Run the tests for an installed copy of trtools # If not already present, megabytes of test data will be downloaded before test running +# Please note that this script tests TRTools against +# test files from a published release and will miss any local changes to those files +# If TRTools was installed normally, this script can be executed by simply running +# 'test_trtools.sh' on the command line. +# Otherwise, if TRTools was installed via poetry, you should run the command +# 'poetry run trtools/testsupport/test_trtools.sh'. echo "Running test_trtools.sh" command -v git >/dev/null 2>&1 || { echo >&2 "git is not available, but is required for downloading the test data. Aborting."; exit 1; } @@ -15,7 +21,7 @@ if [ ! -d "$TMP" ] ; then echo "Downloading test data ..." mkdir $TMP pushd $TMP - git clone -b v$(dumpSTR --version) https://github.com/gymrek-lab/TRTools.git + git clone -b v$(dumpSTR --version) https://github.com/gymrek-lab/TRTools.git . popd echo "Download done" else @@ -41,4 +47,4 @@ cd "$loc" || exit 1 # run unit tests python -m pytest . -p trtools.testsupport.dataloader --datadir "$TMP"/trtools/testsupport # run command line tests -$TMP/test/cmdline_tests.sh $TMP/example-files $TMP/trtools/testsupport/sample_vcfs/beagle \ No newline at end of file +$TMP/test/cmdline_tests.sh $TMP/example-files $TMP/trtools/testsupport/sample_vcfs/beagle $TMP/scripts/trtools_prep_beagle_vcf.sh