diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..340840cf --- /dev/null +++ b/.travis.yml @@ -0,0 +1,41 @@ +language: python +python: + - "2.7" + +install: + - sudo apt-get update + - if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then + wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh; + else + wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; + fi + - bash miniconda.sh -b -p $HOME/miniconda + - export PATH="$HOME/miniconda/bin:$PATH" + - hash -r + - conda config --set always_yes yes --set changeps1 no + - conda update -q conda + - conda info -a + + - conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION + - source activate test-environment + - conda config --add channels conda-forge + - conda config --add channels bioconda + - conda config --add channels anaconda + - conda config --add channels workflowconversion + + - git clone https://github.com/WorkflowConversion/CTDopts $HOME/CTDopts + - cd $HOME/CTDopts + - python setup.py install + - conda install -c conda-forge lxml + - conda install -c conda-forge ruamel.yaml + - conda install libxml2 + - cd $TRAVIS_BUILD_DIR + - python setup.py install + + - conda install coverage green codecov + +script: + - python setup.py test + +after_script: +- python -m codecov diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/test-data/AccurateMassSearch.ctd b/tests/test-data/AccurateMassSearch.ctd new file mode 100644 index 00000000..6092d44e --- /dev/null +++ b/tests/test-data/AccurateMassSearch.ctd @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test-data/AccurateMassSearch.xml b/tests/test-data/AccurateMassSearch.xml new file mode 100644 index 00000000..14bff665 --- /dev/null +++ b/tests/test-data/AccurateMassSearch.xml @@ -0,0 +1,144 @@ + + + + + Match MS signals to molecules from a database by mass. + + AccurateMassSearch + macros.xml + + + + + AccurateMassSearch + +#if str($param_in): + -in $param_in +#end if +#if str($param_out): + -out $param_out +#end if +#if str($param_out_annotation): + -out_annotation $param_out_annotation +#end if +#if str($param_positive_adducts): + -positive_adducts $param_positive_adducts +#end if +#if str($param_negative_adducts): + -negative_adducts $param_negative_adducts +#end if +#if str($param_threads): + -threads $param_threads +#end if +-db:mapping + #for token in $param_db_mapping: + $token + #end for +-db:struct + #for token in $param_db_struct: + $token + #end for +#if str($param_algorithm_mass_error_value): + -algorithm:mass_error_value $param_algorithm_mass_error_value +#end if +#if $param_algorithm_mass_error_unit: + -algorithm:mass_error_unit + #if " " in str($param_algorithm_mass_error_unit): + "$param_algorithm_mass_error_unit" + #else + $param_algorithm_mass_error_unit + #end if +#end if +#if $param_algorithm_ionization_mode: + -algorithm:ionization_mode + #if " " in str($param_algorithm_ionization_mode): + "$param_algorithm_ionization_mode" + #else + $param_algorithm_ionization_mode + #end if +#end if +#if $param_algorithm_isotopic_similarity: + -algorithm:isotopic_similarity +#end if +#if $param_algorithm_keep_unidentified_masses: + -algorithm:keep_unidentified_masses +#end if +#if str($param_algorithm_mzTab_exportIsotopeIntensities): + -algorithm:mzTab:exportIsotopeIntensities $param_algorithm_mzTab_exportIsotopeIntensities +#end if +#if $adv_opts.adv_opts_selector=='advanced': + #if str($adv_opts.param_log): + -log "$adv_opts.param_log" +#end if + #if str($adv_opts.param_debug): + -debug $adv_opts.param_debug +#end if + #if $adv_opts.param_no_progress: + -no_progress +#end if + #if $adv_opts.param_force: + -force +#end if + #if $adv_opts.param_test: + -test +#end if +#end if + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Match MS signals to molecules from a database by mass. + + +For more information, visit http://ftp.mi.fu-berlin.de/OpenMS/release-documentation/html/UTILS_AccurateMassSearch.html + diff --git a/tests/test-data/empty.ctd b/tests/test-data/empty.ctd new file mode 100644 index 00000000..316502e3 --- /dev/null +++ b/tests/test-data/empty.ctd @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/tests/test-data/empty.xml b/tests/test-data/empty.xml new file mode 100644 index 00000000..07e534e7 --- /dev/null +++ b/tests/test-data/empty.xml @@ -0,0 +1,25 @@ + + + + + String parameter tests + + echo StringTest + macros.xml + + + + + <![CDATA[echo StringTest + +> $param_stdout +]]> + + + + + <![CDATA[String parameter tests. + + +For more information, visit http://docs.are/unavailable.html]]> + diff --git a/tests/test-data/float.ctd b/tests/test-data/float.ctd new file mode 100644 index 00000000..2ab6c54d --- /dev/null +++ b/tests/test-data/float.ctd @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test-data/float.xml b/tests/test-data/float.xml new file mode 100644 index 00000000..f4fa7405 --- /dev/null +++ b/tests/test-data/float.xml @@ -0,0 +1,158 @@ + + + + + Floateger parameter tests + + echo FloatTest + macros.xml + + + + + <![CDATA[echo FloatTest + +#if str($param_param_wodefault_mandatory_unrestricted): + -param_wodefault_mandatory_unrestricted $param_param_wodefault_mandatory_unrestricted +#end if +#if str($param_param_default_mandatory_unrestricted): + -param_default_mandatory_unrestricted $param_param_default_mandatory_unrestricted +#end if +#if str($param_param_wodefault_optional_unrestricted): + -param_wodefault_optional_unrestricted $param_param_wodefault_optional_unrestricted +#end if +#if str($param_param_default_optional_unrestricted): + -param_default_optional_unrestricted $param_param_default_optional_unrestricted +#end if +#if str($param_param_wodefault_mandatory_unrestricted_min): + -param_wodefault_mandatory_unrestricted_min $param_param_wodefault_mandatory_unrestricted_min +#end if +#if str($param_param_default_mandatory_unrestricted_min): + -param_default_mandatory_unrestricted_min $param_param_default_mandatory_unrestricted_min +#end if +#if str($param_param_wodefault_optional_unrestricted_min): + -param_wodefault_optional_unrestricted_min $param_param_wodefault_optional_unrestricted_min +#end if +#if str($param_param_default_optional_unrestricted_min): + -param_default_optional_unrestricted_min $param_param_default_optional_unrestricted_min +#end if +#if str($param_param_wodefault_mandatory_unrestricted_max): + -param_wodefault_mandatory_unrestricted_max $param_param_wodefault_mandatory_unrestricted_max +#end if +#if str($param_param_default_mandatory_unrestricted_max): + -param_default_mandatory_unrestricted_max $param_param_default_mandatory_unrestricted_max +#end if +#if str($param_param_wodefault_optional_unrestricted_max): + -param_wodefault_optional_unrestricted_max $param_param_wodefault_optional_unrestricted_max +#end if +#if str($param_param_default_optional_unrestricted_max): + -param_default_optional_unrestricted_max $param_param_default_optional_unrestricted_max +#end if +#if str($param_param_wodefault_mandatory_unrestricted_minmax): + -param_wodefault_mandatory_unrestricted_minmax $param_param_wodefault_mandatory_unrestricted_minmax +#end if +#if str($param_param_default_mandatory_unrestricted_minmax): + -param_default_mandatory_unrestricted_minmax $param_param_default_mandatory_unrestricted_minmax +#end if +#if str($param_param_wodefault_optional_unrestricted_minmax): + -param_wodefault_optional_unrestricted_minmax $param_param_wodefault_optional_unrestricted_minmax +#end if +#if str($param_param_default_optional_unrestricted_minmax): + -param_default_optional_unrestricted_minmax $param_param_default_optional_unrestricted_minmax +#end if +#if $adv_opts.adv_opts_selector=='advanced': + #if str($adv_opts.param_param_wodefault_mandatory_unrestricted_adv): + -param_wodefault_mandatory_unrestricted_adv $adv_opts.param_param_wodefault_mandatory_unrestricted_adv +#end if + #if str($adv_opts.param_param_default_mandatory_unrestricted_adv): + -param_default_mandatory_unrestricted_adv $adv_opts.param_param_default_mandatory_unrestricted_adv +#end if + #if str($adv_opts.param_param_wodefault_optional_unrestricted_adv): + -param_wodefault_optional_unrestricted_adv $adv_opts.param_param_wodefault_optional_unrestricted_adv +#end if + #if str($adv_opts.param_param_default_optional_unrestricted_adv): + -param_default_optional_unrestricted_adv $adv_opts.param_param_default_optional_unrestricted_adv +#end if + #if str($adv_opts.param_param_wodefault_mandatory_unrestricted_adv_min): + -param_wodefault_mandatory_unrestricted_adv_min $adv_opts.param_param_wodefault_mandatory_unrestricted_adv_min +#end if + #if str($adv_opts.param_param_default_mandatory_unrestricted_adv_min): + -param_default_mandatory_unrestricted_adv_min $adv_opts.param_param_default_mandatory_unrestricted_adv_min +#end if + #if str($adv_opts.param_param_wodefault_optional_unrestricted_adv_min): + -param_wodefault_optional_unrestricted_adv_min $adv_opts.param_param_wodefault_optional_unrestricted_adv_min +#end if + #if str($adv_opts.param_param_default_optional_unrestricted_adv_min): + -param_default_optional_unrestricted_adv_min $adv_opts.param_param_default_optional_unrestricted_adv_min +#end if + #if str($adv_opts.param_param_wodefault_mandatory_unrestricted_adv_max): + -param_wodefault_mandatory_unrestricted_adv_max $adv_opts.param_param_wodefault_mandatory_unrestricted_adv_max +#end if + #if str($adv_opts.param_param_default_mandatory_unrestricted_adv_max): + -param_default_mandatory_unrestricted_adv_max $adv_opts.param_param_default_mandatory_unrestricted_adv_max +#end if + #if str($adv_opts.param_param_wodefault_optional_unrestricted_adv_max): + -param_wodefault_optional_unrestricted_adv_max $adv_opts.param_param_wodefault_optional_unrestricted_adv_max +#end if + #if str($adv_opts.param_param_default_optional_unrestricted_adv_max): + -param_default_optional_unrestricted_adv_max $adv_opts.param_param_default_optional_unrestricted_adv_max +#end if + #if str($adv_opts.param_param_wodefault_mandatory_unrestricted_adv_minmax): + -param_wodefault_mandatory_unrestricted_adv_minmax $adv_opts.param_param_wodefault_mandatory_unrestricted_adv_minmax +#end if + #if str($adv_opts.param_param_default_mandatory_unrestricted_adv_minmax): + -param_default_mandatory_unrestricted_adv_minmax $adv_opts.param_param_default_mandatory_unrestricted_adv_minmax +#end if + #if str($adv_opts.param_param_wodefault_optional_unrestricted_adv_minmax): + -param_wodefault_optional_unrestricted_adv_minmax $adv_opts.param_param_wodefault_optional_unrestricted_adv_minmax +#end if + #if str($adv_opts.param_param_default_optional_unrestricted_adv_minmax): + -param_default_optional_unrestricted_adv_minmax $adv_opts.param_param_default_optional_unrestricted_adv_minmax +#end if +#end if +> $param_stdout +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <![CDATA[Floateger parameter tests. + + +For more information, visit http://docs.are/unavailable.html]]> + diff --git a/tests/test-data/integer.ctd b/tests/test-data/integer.ctd new file mode 100644 index 00000000..356b58da --- /dev/null +++ b/tests/test-data/integer.ctd @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test-data/integer.xml b/tests/test-data/integer.xml new file mode 100644 index 00000000..4ae33636 --- /dev/null +++ b/tests/test-data/integer.xml @@ -0,0 +1,158 @@ + + + + + Integer parameter tests + + echo IntTest + macros.xml + + + + + <![CDATA[echo IntTest + +#if str($param_param_wodefault_mandatory_unrestricted): + -param_wodefault_mandatory_unrestricted $param_param_wodefault_mandatory_unrestricted +#end if +#if str($param_param_default_mandatory_unrestricted): + -param_default_mandatory_unrestricted $param_param_default_mandatory_unrestricted +#end if +#if str($param_param_wodefault_optional_unrestricted): + -param_wodefault_optional_unrestricted $param_param_wodefault_optional_unrestricted +#end if +#if str($param_param_default_optional_unrestricted): + -param_default_optional_unrestricted $param_param_default_optional_unrestricted +#end if +#if str($param_param_wodefault_mandatory_unrestricted_min): + -param_wodefault_mandatory_unrestricted_min $param_param_wodefault_mandatory_unrestricted_min +#end if +#if str($param_param_default_mandatory_unrestricted_min): + -param_default_mandatory_unrestricted_min $param_param_default_mandatory_unrestricted_min +#end if +#if str($param_param_wodefault_optional_unrestricted_min): + -param_wodefault_optional_unrestricted_min $param_param_wodefault_optional_unrestricted_min +#end if +#if str($param_param_default_optional_unrestricted_min): + -param_default_optional_unrestricted_min $param_param_default_optional_unrestricted_min +#end if +#if str($param_param_wodefault_mandatory_unrestricted_max): + -param_wodefault_mandatory_unrestricted_max $param_param_wodefault_mandatory_unrestricted_max +#end if +#if str($param_param_default_mandatory_unrestricted_max): + -param_default_mandatory_unrestricted_max $param_param_default_mandatory_unrestricted_max +#end if +#if str($param_param_wodefault_optional_unrestricted_max): + -param_wodefault_optional_unrestricted_max $param_param_wodefault_optional_unrestricted_max +#end if +#if str($param_param_default_optional_unrestricted_max): + -param_default_optional_unrestricted_max $param_param_default_optional_unrestricted_max +#end if +#if str($param_param_wodefault_mandatory_unrestricted_minmax): + -param_wodefault_mandatory_unrestricted_minmax $param_param_wodefault_mandatory_unrestricted_minmax +#end if +#if str($param_param_default_mandatory_unrestricted_minmax): + -param_default_mandatory_unrestricted_minmax $param_param_default_mandatory_unrestricted_minmax +#end if +#if str($param_param_wodefault_optional_unrestricted_minmax): + -param_wodefault_optional_unrestricted_minmax $param_param_wodefault_optional_unrestricted_minmax +#end if +#if str($param_param_default_optional_unrestricted_minmax): + -param_default_optional_unrestricted_minmax $param_param_default_optional_unrestricted_minmax +#end if +#if $adv_opts.adv_opts_selector=='advanced': + #if str($adv_opts.param_param_wodefault_mandatory_unrestricted_adv): + -param_wodefault_mandatory_unrestricted_adv $adv_opts.param_param_wodefault_mandatory_unrestricted_adv +#end if + #if str($adv_opts.param_param_default_mandatory_unrestricted_adv): + -param_default_mandatory_unrestricted_adv $adv_opts.param_param_default_mandatory_unrestricted_adv +#end if + #if str($adv_opts.param_param_wodefault_optional_unrestricted_adv): + -param_wodefault_optional_unrestricted_adv $adv_opts.param_param_wodefault_optional_unrestricted_adv +#end if + #if str($adv_opts.param_param_default_optional_unrestricted_adv): + -param_default_optional_unrestricted_adv $adv_opts.param_param_default_optional_unrestricted_adv +#end if + #if str($adv_opts.param_param_wodefault_mandatory_unrestricted_adv_min): + -param_wodefault_mandatory_unrestricted_adv_min $adv_opts.param_param_wodefault_mandatory_unrestricted_adv_min +#end if + #if str($adv_opts.param_param_default_mandatory_unrestricted_adv_min): + -param_default_mandatory_unrestricted_adv_min $adv_opts.param_param_default_mandatory_unrestricted_adv_min +#end if + #if str($adv_opts.param_param_wodefault_optional_unrestricted_adv_min): + -param_wodefault_optional_unrestricted_adv_min $adv_opts.param_param_wodefault_optional_unrestricted_adv_min +#end if + #if str($adv_opts.param_param_default_optional_unrestricted_adv_min): + -param_default_optional_unrestricted_adv_min $adv_opts.param_param_default_optional_unrestricted_adv_min +#end if + #if str($adv_opts.param_param_wodefault_mandatory_unrestricted_adv_max): + -param_wodefault_mandatory_unrestricted_adv_max $adv_opts.param_param_wodefault_mandatory_unrestricted_adv_max +#end if + #if str($adv_opts.param_param_default_mandatory_unrestricted_adv_max): + -param_default_mandatory_unrestricted_adv_max $adv_opts.param_param_default_mandatory_unrestricted_adv_max +#end if + #if str($adv_opts.param_param_wodefault_optional_unrestricted_adv_max): + -param_wodefault_optional_unrestricted_adv_max $adv_opts.param_param_wodefault_optional_unrestricted_adv_max +#end if + #if str($adv_opts.param_param_default_optional_unrestricted_adv_max): + -param_default_optional_unrestricted_adv_max $adv_opts.param_param_default_optional_unrestricted_adv_max +#end if + #if str($adv_opts.param_param_wodefault_mandatory_unrestricted_adv_minmax): + -param_wodefault_mandatory_unrestricted_adv_minmax $adv_opts.param_param_wodefault_mandatory_unrestricted_adv_minmax +#end if + #if str($adv_opts.param_param_default_mandatory_unrestricted_adv_minmax): + -param_default_mandatory_unrestricted_adv_minmax $adv_opts.param_param_default_mandatory_unrestricted_adv_minmax +#end if + #if str($adv_opts.param_param_wodefault_optional_unrestricted_adv_minmax): + -param_wodefault_optional_unrestricted_adv_minmax $adv_opts.param_param_wodefault_optional_unrestricted_adv_minmax +#end if + #if str($adv_opts.param_param_default_optional_unrestricted_adv_minmax): + -param_default_optional_unrestricted_adv_minmax $adv_opts.param_param_default_optional_unrestricted_adv_minmax +#end if +#end if +> $param_stdout +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <![CDATA[Integer parameter tests. + + +For more information, visit http://docs.are/unavailable.html]]> + diff --git a/tests/test-data/macros.xml b/tests/test-data/macros.xml new file mode 100644 index 00000000..82907e42 --- /dev/null +++ b/tests/test-data/macros.xml @@ -0,0 +1,31 @@ + + + + + requirement + + + + + + + + + + + doi:10.1186/1471-2105-9-163 + + + + + + + + + + + + + + + diff --git a/tests/test-data/select.ctd b/tests/test-data/select.ctd new file mode 100644 index 00000000..f141dd12 --- /dev/null +++ b/tests/test-data/select.ctd @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test-data/select.xml b/tests/test-data/select.xml new file mode 100644 index 00000000..d79bf0f2 --- /dev/null +++ b/tests/test-data/select.xml @@ -0,0 +1,134 @@ + + + + + String parameter tests + + echo SelectTest + macros.xml + + + + + <![CDATA[echo SelectTest + +#if $param_param_wodefault_mandatory_restricted: + -param_wodefault_mandatory_restricted + #if " " in str($param_param_wodefault_mandatory_restricted): + "$param_param_wodefault_mandatory_restricted" + #else + $param_param_wodefault_mandatory_restricted + #end if +#end if +#if $param_param_default_mandatory_restricted: + -param_default_mandatory_restricted + #if " " in str($param_param_default_mandatory_restricted): + "$param_param_default_mandatory_restricted" + #else + $param_param_default_mandatory_restricted + #end if +#end if +#if $param_param_wodefault_optional_restricted: + -param_wodefault_optional_restricted + #if " " in str($param_param_wodefault_optional_restricted): + "$param_param_wodefault_optional_restricted" + #else + $param_param_wodefault_optional_restricted + #end if +#end if +#if $param_param_default_optional_restricted: + -param_default_optional_restricted + #if " " in str($param_param_default_optional_restricted): + "$param_param_default_optional_restricted" + #else + $param_param_default_optional_restricted + #end if +#end if +#if $adv_opts.adv_opts_selector=='advanced': + #if $adv_opts.param_param_wodefault_mandatory_restricted_adv: + -param_wodefault_mandatory_restricted_adv + #if " " in str($adv_opts.param_param_wodefault_mandatory_restricted_adv): + "$adv_opts.param_param_wodefault_mandatory_restricted_adv" + #else + $adv_opts.param_param_wodefault_mandatory_restricted_adv + #end if +#end if + #if $adv_opts.param_param_default_mandatory_restricted_adv: + -param_default_mandatory_restricted_adv + #if " " in str($adv_opts.param_param_default_mandatory_restricted_adv): + "$adv_opts.param_param_default_mandatory_restricted_adv" + #else + $adv_opts.param_param_default_mandatory_restricted_adv + #end if +#end if + #if $adv_opts.param_param_wodefault_optional_restricted_adv: + -param_wodefault_optional_restricted_adv + #if " " in str($adv_opts.param_param_wodefault_optional_restricted_adv): + "$adv_opts.param_param_wodefault_optional_restricted_adv" + #else + $adv_opts.param_param_wodefault_optional_restricted_adv + #end if +#end if + #if $adv_opts.param_param_default_optional_restricted_adv: + -param_default_optional_restricted_adv + #if " " in str($adv_opts.param_param_default_optional_restricted_adv): + "$adv_opts.param_param_default_optional_restricted_adv" + #else + $adv_opts.param_param_default_optional_restricted_adv + #end if +#end if +#end if +> $param_stdout +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <![CDATA[String parameter tests. + + +For more information, visit http://docs.are/unavailable.html]]> + diff --git a/tests/test-data/string.ctd b/tests/test-data/string.ctd new file mode 100644 index 00000000..11517f36 --- /dev/null +++ b/tests/test-data/string.ctd @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test-data/string.xml b/tests/test-data/string.xml new file mode 100644 index 00000000..67109ad6 --- /dev/null +++ b/tests/test-data/string.xml @@ -0,0 +1,118 @@ + + + + + String parameter tests + + echo StringTest + macros.xml + + + + + <![CDATA[echo StringTest + +#if str($param_param_wodefault_mandatory_unrestricted): + -param_wodefault_mandatory_unrestricted "$param_param_wodefault_mandatory_unrestricted" +#end if +#if str($param_param_default_mandatory_unrestricted): + -param_default_mandatory_unrestricted "$param_param_default_mandatory_unrestricted" +#end if +#if str($param_param_wodefault_optional_unrestricted): + -param_wodefault_optional_unrestricted "$param_param_wodefault_optional_unrestricted" +#end if +#if str($param_param_default_optional_unrestricted): + -param_default_optional_unrestricted "$param_param_default_optional_unrestricted" +#end if +#if $adv_opts.adv_opts_selector=='advanced': + #if str($adv_opts.param_param_wodefault_mandatory_unrestricted_adv): + -param_wodefault_mandatory_unrestricted_adv "$adv_opts.param_param_wodefault_mandatory_unrestricted_adv" +#end if + #if str($adv_opts.param_param_default_mandatory_unrestricted_adv): + -param_default_mandatory_unrestricted_adv "$adv_opts.param_param_default_mandatory_unrestricted_adv" +#end if + #if str($adv_opts.param_param_wodefault_optional_unrestricted_adv): + -param_wodefault_optional_unrestricted_adv "$adv_opts.param_param_wodefault_optional_unrestricted_adv" +#end if + #if str($adv_opts.param_param_default_optional_unrestricted_adv): + -param_default_optional_unrestricted_adv "$adv_opts.param_param_default_optional_unrestricted_adv" +#end if +#end if +> $param_stdout +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <![CDATA[String parameter tests. + + +For more information, visit http://docs.are/unavailable.html]]> + diff --git a/tests/test_galaxy_cli.py b/tests/test_galaxy_cli.py new file mode 100644 index 00000000..51de457a --- /dev/null +++ b/tests/test_galaxy_cli.py @@ -0,0 +1,64 @@ +import unittest +import os +import subprocess +import tempfile + +def to_test_data(*args): + return os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "test-data", *args)) + +def file2list(pth): + with open(pth) as f: + lines = f.readlines() + return lines + +class GalaxyCliTestCase(unittest.TestCase): + + def _compare_cli_output(self, fileprefix): + in_pth = to_test_data('{}.ctd'.format(fileprefix)) + macro_pth = to_test_data('macros.xml') + tmp = tempfile.mkdtemp() + + out_file = os.path.join(tmp, '{}.xml'.format(fileprefix)) + #out_file = to_test_data('{}.xml'.format(fileprefix)) + + cmd = ['CTDConverter', 'galaxy', '-i', in_pth, '-o', out_file, '-m', macro_pth, '-b', 'version'] + print(cmd) + + popen = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + output, err = popen.communicate() + print(output) + print(err) + + old_file_pth = to_test_data('{}.xml'.format(fileprefix)) + + print(out_file) + print(old_file_pth) + + new_l = file2list(out_file) + old_l = file2list(old_file_pth) + + for i in range(0, len(new_l)): + self.assertEqual(new_l[i].rstrip(), old_l[i].rstrip()) + + def test_galaxy_cli_full_file_ctd(self): + self._compare_cli_output('AccurateMassSearch') + + def test_galaxy_cli_empty_ctd(self): + self._compare_cli_output('empty') + + def test_galaxy_cli_float_ctd(self): + self._compare_cli_output('float') + + def test_galaxy_cli_integer_ctd(self): + self._compare_cli_output('integer') + + def test_galaxy_cli_select_ctd(self): + self._compare_cli_output('select') + + def test_galaxy_cli_string_ctd(self): + self._compare_cli_output('string') + + + +if __name__ == '__main__': + unittest.main()