4 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/9dd03dd46d04/ Changeset: 9dd03dd46d04 User: jmchilton Date: 2014-04-28 18:48:51 Summary: Create run_tests.sh to replace run_functional_tests.sh Should be backward compatible but features better argument handling - things can appear in other orders (-id x -data_managers is the same as -data_managers -id x for instance), better error messages if arguments are missing, and more standard short argument with single dash or long argument with double dash variants of each argument are available. Affected #: 1 file diff -r 4a6cd1da30d0c4e3f8e0ed7b1c1e6342bed20e44 -r 9dd03dd46d04b83aeb270ebe538d6075facb5379 run_tests.sh --- /dev/null +++ b/run_tests.sh @@ -0,0 +1,149 @@ +#!/bin/sh + +# A good place to look for nose info: http://somethingaboutorange.com/mrl/projects/nose/ +rm -f run_functional_tests.log + +show_help() { +cat <<EOF +'${0##*/}' for testing all the tools in functional directory +'${0##*/} aaa' for testing one test case of 'aaa' ('aaa' is the file name with path) +'${0##*/} -id bbb' for testing one tool with id 'bbb' ('bbb' is the tool id) +'${0##*/} -sid ccc' for testing one section with sid 'ccc' ('ccc' is the string after 'section::') +'${0##*/} -list' for listing all the tool ids +'${0##*/} -toolshed' for running all the test scripts in the ./test/tool_shed/functional directory +'${0##*/} -toolshed testscriptname' for running one test script named testscriptname in the .test/tool_shed/functional directory +'${0##*/} -workflow test.xml' for running a workflow test case as defined by supplied workflow xml test file (experimental) +'${0##*/} -framework' for running through example tool tests testing framework features in test/functional/tools" +'${0##*/} -framework -id toolid' for testing one framework tool (in test/functional/tools/) with id 'toolid' +'${0##*/} -data_managers -id data_manager_id' for testing one Data Manager with id 'data_manager_id' +EOF +} + +show_list() { + python tool_list.py + echo "===========================================================================================================================================" + echo "'${0##*/} -id bbb' for testing one tool with id 'bbb' ('bbb' is the tool id)" + echo "'${0##*/} -sid ccc' for testing one section with sid 'ccc' ('ccc' is the string after 'section::')" +} + +test_script="./scripts/functional_tests.py" +report_file="run_functional_tests.html" + +while : +do + case "$1" in + -h|--help|-\?) + show_help + exit 0 + ;; + -l|-list|--list) + show_list + exit 0 + ;; + -id|--id) + if [ $# -gt 1 ]; then + test_id=$2; + shift 2 + else + echo "--id requires an argument" 1>&2 + exit 1 + fi + ;; + -s|-sid|--sid) + if [ $# -gt 1 ]; then + section_id=$2 + shift 2 + else + echo "--sid requires an argument" 1>&2 + exit 1 + fi + ;; + -t|-toolshed|--toolshed) + test_script="./test/tool_shed/functional_tests.py" + report_file="./test/tool_shed/run_functional_tests.html" + if [ $# -gt 1 ]; then + toolshed_script=$2 + shift 2 + else + toolshed_script="./test/tool_shed/functional" + shift 1 + fi + ;; + -w|-workflow|--workflow) + if [ $# -gt 1 ]; then + workflow_file=$2 + workflow_test=1 + shift 2 + else + echo "--workflow requires an argument" 1>&2 + exit 1 + fi + ;; + -f|-framework|--framework) + framework_test=1; + shift 1 + ;; + -d|-data_managers|--data_managers) + data_managers_test=1; + shift 1 + ;; + -m|-migrated|--migrated) + migrated_test=1; + shift + ;; + -i|-installed|--installed) + installed_test=1; + shift + ;; + -r|--report_file) + if [ $# -gt 1 ]; then + report_file=$2 + shift 2 + else + echo "--report_file requires an argument" 1>&2 + exit 1 + fi + ;; + --) + shift + break + ;; + -*) + echo "invalid option: $1" 1>&2; + show_help + exit 1 + ;; + *) + break; + ;; + esac +done + +if [ -n "$migrated_test" ] ; then + [ -n "$test_id" ] && class=":TestForTool_$test_id" || class="" + extra_args="functional.test_toolbox$class -migrated" +elif [ -n "$installed_test" ] ; then + [ -n "$test_id" ] && class=":TestForTool_$test_id" || class="" + extra_args="functional.test_toolbox$class -installed" +elif [ -n "$framework_test" ] ; then + [ -n "$test_id" ] && class=":TestForTool_$test_id" || class="" + extra_args="functional.test_toolbox$class -framework" +elif [ -n "$data_managers_test" ] ; then + [ -n "$test_id" ] && class=":TestForDataManagerTool_$test_id" || class="" + extra_args="functional.test_data_managers$class -data_managers" +elif [ -n "$workflow_test" ]; then + extra_args="functional.workflow:WorkflowTestCase $workflow_file" +elif [ -n "$toolshed_script" ]; then + extra_args="$toolshed_script" +elif [ -n "$section_id" ]; then + extra_args=`python tool_list.py $section_id` +elif [ -n "$test_id" ]; then + class=":TestForTool_$test_id" + extra_args="functional.test_toolbox$class" +elif [ -n "$1" ] ; then + extra_args="$1" +else + extra_args='--exclude="^get" functional' +fi + +python $test_script $coverage_arg -v --with-nosehtml --html-report-file $report_file $extra_args https://bitbucket.org/galaxy/galaxy-central/commits/08754cf82e62/ Changeset: 08754cf82e62 User: jmchilton Date: 2014-04-28 18:48:51 Summary: Add unit tests to run_tests.sh. Affected #: 1 file diff -r 9dd03dd46d04b83aeb270ebe538d6075facb5379 -r 08754cf82e625cb6c6fa88aeb6e4195b222da64b run_tests.sh --- a/run_tests.sh +++ b/run_tests.sh @@ -16,6 +16,8 @@ '${0##*/} -framework' for running through example tool tests testing framework features in test/functional/tools" '${0##*/} -framework -id toolid' for testing one framework tool (in test/functional/tools/) with id 'toolid' '${0##*/} -data_managers -id data_manager_id' for testing one Data Manager with id 'data_manager_id' +'${0##*/} -unit' for running all unit tests (doctests in lib and tests in test/unit) +'${0##*/} -unit testscriptath' running particular tests scripts EOF } @@ -104,6 +106,24 @@ exit 1 fi ;; + -c|--coverage) + # Must have coverage installed (try `which coverage`) - only valid with --unit + # for now. Would be great to get this to work with functional tests though. + coverage_arg="--with-coverage" + NOSE_WITH_COVERAGE=true + shift + ;; + -u|-unit|--unit) + report_file="run_unit_tests.html" + test_script="./scripts/nosetests.py" + if [ $# -gt 1 ]; then + unit_extra=$2 + shift 2 + else + unit_extra='--exclude=functional --exclude="^get" --exclude=controllers --exclude=runners lib test/unit' + shift 1 + fi + ;; --) shift break @@ -140,6 +160,8 @@ elif [ -n "$test_id" ]; then class=":TestForTool_$test_id" extra_args="functional.test_toolbox$class" +elif [ -n "$unit_extra" ]; then + extra_args="--with-doctest $unit_extra" elif [ -n "$1" ] ; then extra_args="$1" else https://bitbucket.org/galaxy/galaxy-central/commits/e8047b8f1e24/ Changeset: e8047b8f1e24 User: jmchilton Date: 2014-04-28 18:48:51 Summary: Add qunit test options to new run_tests.sh script. Can target specific tests or all tests and can optionally watch tests using Carl's work on 'grunt watch'. Affected #: 1 file diff -r 08754cf82e625cb6c6fa88aeb6e4195b222da64b -r e8047b8f1e24a4815138e5862f24096dfc4d9c79 run_tests.sh --- a/run_tests.sh +++ b/run_tests.sh @@ -18,6 +18,8 @@ '${0##*/} -data_managers -id data_manager_id' for testing one Data Manager with id 'data_manager_id' '${0##*/} -unit' for running all unit tests (doctests in lib and tests in test/unit) '${0##*/} -unit testscriptath' running particular tests scripts +'${0##*/} -qunit' for running qunit JavaScript tests +'${0##*/} -qunit testname' for running single JavaScript test with given name EOF } @@ -31,6 +33,8 @@ test_script="./scripts/functional_tests.py" report_file="run_functional_tests.html" +driver="python" + while : do case "$1" in @@ -124,6 +128,24 @@ shift 1 fi ;; + -q|-qunit|--qunit) + # Requires grunt installed and dependencies configured see + # test/qunit/README.txt for more information. + driver="grunt" + gruntfile="./test/qunit/Gruntfile.js" + if [ $# -gt 1 ]; then + qunit_name=$2 + shift 2 + else + shift 1 + fi + ;; + -watch|--watch) + # Have grunt watch test or directory for changes, only + # valid for javascript testing. + watch=1 + shift + ;; --) shift break @@ -168,4 +190,21 @@ extra_args='--exclude="^get" functional' fi -python $test_script $coverage_arg -v --with-nosehtml --html-report-file $report_file $extra_args +if [ "$driver" = "python" ]; then + python $test_script $coverage_arg -v --with-nosehtml --html-report-file $report_file $extra_args +else + if [ -n "$watch" ]; then + grunt_task="watch" + else + grunt_task="" + fi + if [ -n "$qunit_name" ]; then + grunt_args="--test=$qunit_name" + else + grunt_args="" + fi + # TODO: Exapnd javascript helpers to include setting up + # grunt deps in npm, "watch"ing directory, and running casper + # functional tests. + grunt --gruntfile=$gruntfile $grunt_task $grunt_args +fi https://bitbucket.org/galaxy/galaxy-central/commits/28b307e0c087/ Changeset: 28b307e0c087 User: jmchilton Date: 2014-04-28 18:48:51 Summary: Rework test framework testing and tools. -framework will still cause just a small set of non-default, non-user facing tools to be tested and exerise various aspects of the tool and test frameworks, but now an argument can be passed in -with_framework_test_tools to allow these tools to be used as part of the normal test framework (i.e. when not using -framework). This serves two purposes - to ensure the feature coverage of existing tests remains high as the tests are migrated out of the distribution and to allow a set of tests to be available for functional (e.g. API tests) that users don't need to see. Affected #: 15 files diff -r e8047b8f1e24a4815138e5862f24096dfc4d9c79 -r 28b307e0c08791b3073dd27c0189fdd28083045d run_tests.sh --- a/run_tests.sh +++ b/run_tests.sh @@ -32,6 +32,7 @@ test_script="./scripts/functional_tests.py" report_file="run_functional_tests.html" +with_framework_test_tools_arg="" driver="python" @@ -75,6 +76,10 @@ shift 1 fi ;; + -with_framework_test_tools|--with_framework_test_tools) + with_framework_test_tools_arg="-with_framework_test_tools" + shift + ;; -w|-workflow|--workflow) if [ $# -gt 1 ]; then workflow_file=$2 @@ -191,7 +196,7 @@ fi if [ "$driver" = "python" ]; then - python $test_script $coverage_arg -v --with-nosehtml --html-report-file $report_file $extra_args + python $test_script $coverage_arg -v --with-nosehtml --html-report-file $report_file $with_framework_test_tools_arg $extra_args else if [ -n "$watch" ]; then grunt_task="watch" diff -r e8047b8f1e24a4815138e5862f24096dfc4d9c79 -r 28b307e0c08791b3073dd27c0189fdd28083045d scripts/functional_tests.py --- a/scripts/functional_tests.py +++ b/scripts/functional_tests.py @@ -217,16 +217,19 @@ # Exclude all files except test_toolbox.py. ignore_files = ( re.compile( r'^test_[adghlmsu]*' ), re.compile( r'^test_ta*' ) ) else: + framework_tool_dir = os.path.join('test', 'functional', 'tools') framework_test = __check_arg( '-framework' ) # Run through suite of tests testing framework. if framework_test: - framework_tool_dir = os.path.join('test', 'functional', 'tools') tool_conf = os.path.join( framework_tool_dir, 'samples_tool_conf.xml' ) datatypes_conf_override = os.path.join( framework_tool_dir, 'sample_datatypes_conf.xml' ) - test_dir = os.path.join( framework_tool_dir, 'test-data') else: # Use tool_conf.xml toolbox. tool_conf = 'tool_conf.xml' - test_dir = default_galaxy_test_file_dir + if __check_arg( '-with_framework_test_tools' ): + # Some of these tools will not work without swapping + # default interactor to point to test. + tool_conf = "%s,%s" % ( tool_conf, os.path.join( framework_tool_dir, 'samples_tool_conf.xml' ) ) + test_dir = default_galaxy_test_file_dir tool_config_file = os.environ.get( 'GALAXY_TEST_TOOL_CONF', tool_conf ) galaxy_test_file_dir = os.environ.get( 'GALAXY_TEST_FILE_DIR', test_dir ) if not os.path.isabs( galaxy_test_file_dir ): diff -r e8047b8f1e24a4815138e5862f24096dfc4d9c79 -r 28b307e0c08791b3073dd27c0189fdd28083045d test-data/simple_line.txt --- /dev/null +++ b/test-data/simple_line.txt @@ -0,0 +1,1 @@ +This is a line of text. diff -r e8047b8f1e24a4815138e5862f24096dfc4d9c79 -r 28b307e0c08791b3073dd27c0189fdd28083045d test-data/simple_line_alternative.txt --- /dev/null +++ b/test-data/simple_line_alternative.txt @@ -0,0 +1,1 @@ +This is a different line of text. \ No newline at end of file diff -r e8047b8f1e24a4815138e5862f24096dfc4d9c79 -r 28b307e0c08791b3073dd27c0189fdd28083045d test-data/simple_line_x2.txt --- /dev/null +++ b/test-data/simple_line_x2.txt @@ -0,0 +1,2 @@ +This is a line of text. +This is a line of text. diff -r e8047b8f1e24a4815138e5862f24096dfc4d9c79 -r 28b307e0c08791b3073dd27c0189fdd28083045d test-data/simple_line_x3.txt --- /dev/null +++ b/test-data/simple_line_x3.txt @@ -0,0 +1,3 @@ +This is a line of text. +This is a line of text. +This is a line of text. diff -r e8047b8f1e24a4815138e5862f24096dfc4d9c79 -r 28b307e0c08791b3073dd27c0189fdd28083045d test-data/simple_line_x5.txt --- /dev/null +++ b/test-data/simple_line_x5.txt @@ -0,0 +1,5 @@ +This is a line of text. +This is a line of text. +This is a line of text. +This is a line of text. +This is a line of text. diff -r e8047b8f1e24a4815138e5862f24096dfc4d9c79 -r 28b307e0c08791b3073dd27c0189fdd28083045d test-data/simple_lines_interleaved.txt --- /dev/null +++ b/test-data/simple_lines_interleaved.txt @@ -0,0 +1,4 @@ +This is a line of text. +This is a different line of text. +This is a line of text. +This is a different line of text. \ No newline at end of file diff -r e8047b8f1e24a4815138e5862f24096dfc4d9c79 -r 28b307e0c08791b3073dd27c0189fdd28083045d test/functional/tools/test-data/simple_line.txt --- a/test/functional/tools/test-data/simple_line.txt +++ /dev/null @@ -1,1 +0,0 @@ -This is a line of text. diff -r e8047b8f1e24a4815138e5862f24096dfc4d9c79 -r 28b307e0c08791b3073dd27c0189fdd28083045d test/functional/tools/test-data/simple_line_alternative.txt --- a/test/functional/tools/test-data/simple_line_alternative.txt +++ /dev/null @@ -1,1 +0,0 @@ -This is a different line of text. \ No newline at end of file diff -r e8047b8f1e24a4815138e5862f24096dfc4d9c79 -r 28b307e0c08791b3073dd27c0189fdd28083045d test/functional/tools/test-data/simple_line_x2.txt --- a/test/functional/tools/test-data/simple_line_x2.txt +++ /dev/null @@ -1,2 +0,0 @@ -This is a line of text. -This is a line of text. diff -r e8047b8f1e24a4815138e5862f24096dfc4d9c79 -r 28b307e0c08791b3073dd27c0189fdd28083045d test/functional/tools/test-data/simple_line_x3.txt --- a/test/functional/tools/test-data/simple_line_x3.txt +++ /dev/null @@ -1,3 +0,0 @@ -This is a line of text. -This is a line of text. -This is a line of text. diff -r e8047b8f1e24a4815138e5862f24096dfc4d9c79 -r 28b307e0c08791b3073dd27c0189fdd28083045d test/functional/tools/test-data/simple_line_x5.txt --- a/test/functional/tools/test-data/simple_line_x5.txt +++ /dev/null @@ -1,5 +0,0 @@ -This is a line of text. -This is a line of text. -This is a line of text. -This is a line of text. -This is a line of text. diff -r e8047b8f1e24a4815138e5862f24096dfc4d9c79 -r 28b307e0c08791b3073dd27c0189fdd28083045d test/functional/tools/test-data/simple_lines_interleaved.txt --- a/test/functional/tools/test-data/simple_lines_interleaved.txt +++ /dev/null @@ -1,4 +0,0 @@ -This is a line of text. -This is a different line of text. -This is a line of text. -This is a different line of text. \ No newline at end of file diff -r e8047b8f1e24a4815138e5862f24096dfc4d9c79 -r 28b307e0c08791b3073dd27c0189fdd28083045d test/functional/tools/test-data/velveth_test1 --- a/test/functional/tools/test-data/velveth_test1 +++ /dev/null @@ -1,1 +0,0 @@ -../../../../test-data/velveth_test1 \ No newline at end of file Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.