From bc61761dc1a92f5e22f868fabfb75e1e7195210b Mon Sep 17 00:00:00 2001 From: Bjoern Gruening Date: Fri, 9 Aug 2019 17:08:52 +0200 Subject: [PATCH 1/7] Add assert for n_lines. This can be used in tool and workflow testing. --- lib/galaxy/tool_util/verify/asserts/text.py | 6 ++++++ lib/galaxy/tool_util/xsd/galaxy.xsd | 7 +++++++ test/functional/tools/validation_default.xml | 5 +++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/tool_util/verify/asserts/text.py b/lib/galaxy/tool_util/verify/asserts/text.py index 74b7d741215..d0110be1eae 100644 --- a/lib/galaxy/tool_util/verify/asserts/text.py +++ b/lib/galaxy/tool_util/verify/asserts/text.py @@ -20,6 +20,12 @@ def assert_has_line(output, line): assert match is not None, "No line of output file was '%s' (output was '%s') " % (line, output) +def assert_has_n_lines(output, n): + """ Asserts the specified output if the number of lines match the given number.""" + for counter, line in enumerate(output.split('\n')): + pass + assert counter == int(n), "Expected number of lines (%s) do not match with obtained number ('%s')" % (n, counter) + def assert_has_text_matching(output, expression): """ Asserts the specified output contains text matching the regular expression specified by the argument expression.""" diff --git a/lib/galaxy/tool_util/xsd/galaxy.xsd b/lib/galaxy/tool_util/xsd/galaxy.xsd index cea5aa9e6f6..bee920ca8e8 100644 --- a/lib/galaxy/tool_util/xsd/galaxy.xsd +++ b/lib/galaxy/tool_util/xsd/galaxy.xsd @@ -716,6 +716,7 @@ specified and instead a series of assertions is made about the output. + @@ -1602,6 +1603,12 @@ module. + + + ``).]]> + + + ``).]]> diff --git a/test/functional/tools/validation_default.xml b/test/functional/tools/validation_default.xml index 0aba8077931..a043679f599 100644 --- a/test/functional/tools/validation_default.xml +++ b/test/functional/tools/validation_default.xml @@ -1,6 +1,6 @@ - + - echo "$input1" > out1; + echo '$input1' > out1; echo $float_param > out2; echo $select_param > out3; @@ -25,6 +25,7 @@ + From b7c6b1896cce0b8e72c91cd96168d6a587a9748c Mon Sep 17 00:00:00 2001 From: Bjoern Gruening Date: Fri, 9 Aug 2019 22:18:19 +0200 Subject: [PATCH 2/7] fix lint --- lib/galaxy/tool_util/verify/asserts/text.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/galaxy/tool_util/verify/asserts/text.py b/lib/galaxy/tool_util/verify/asserts/text.py index d0110be1eae..9b5426849fe 100644 --- a/lib/galaxy/tool_util/verify/asserts/text.py +++ b/lib/galaxy/tool_util/verify/asserts/text.py @@ -26,6 +26,7 @@ def assert_has_n_lines(output, n): pass assert counter == int(n), "Expected number of lines (%s) do not match with obtained number ('%s')" % (n, counter) + def assert_has_text_matching(output, expression): """ Asserts the specified output contains text matching the regular expression specified by the argument expression.""" From ed5029131a00158d248125342abce0b6aa84f95b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gr=C3=BCning?= Date: Sat, 17 Aug 2019 13:16:46 +0200 Subject: [PATCH 3/7] Update lib/galaxy/tool_util/verify/asserts/text.py Co-Authored-By: Marius van den Beek --- lib/galaxy/tool_util/verify/asserts/text.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/tool_util/verify/asserts/text.py b/lib/galaxy/tool_util/verify/asserts/text.py index 9b5426849fe..38c5b49d210 100644 --- a/lib/galaxy/tool_util/verify/asserts/text.py +++ b/lib/galaxy/tool_util/verify/asserts/text.py @@ -21,7 +21,7 @@ def assert_has_line(output, line): def assert_has_n_lines(output, n): - """ Asserts the specified output if the number of lines match the given number.""" + """Asserts the specified output contains ``n`` lines.""" for counter, line in enumerate(output.split('\n')): pass assert counter == int(n), "Expected number of lines (%s) do not match with obtained number ('%s')" % (n, counter) From 6dddc9e48c9fc39a4ff3376bf47585ad3f745cba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gr=C3=BCning?= Date: Sat, 17 Aug 2019 13:20:36 +0200 Subject: [PATCH 4/7] Update lib/galaxy/tool_util/verify/asserts/text.py Co-Authored-By: Marius van den Beek --- lib/galaxy/tool_util/verify/asserts/text.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/tool_util/verify/asserts/text.py b/lib/galaxy/tool_util/verify/asserts/text.py index 38c5b49d210..ee234cf9de1 100644 --- a/lib/galaxy/tool_util/verify/asserts/text.py +++ b/lib/galaxy/tool_util/verify/asserts/text.py @@ -22,7 +22,7 @@ def assert_has_line(output, line): def assert_has_n_lines(output, n): """Asserts the specified output contains ``n`` lines.""" - for counter, line in enumerate(output.split('\n')): + n_lines_found = len(output.splitlines()) pass assert counter == int(n), "Expected number of lines (%s) do not match with obtained number ('%s')" % (n, counter) From b579dde8c586c2e425e60e4948f96184d43dda07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gr=C3=BCning?= Date: Sat, 17 Aug 2019 13:20:56 +0200 Subject: [PATCH 5/7] Update lib/galaxy/tool_util/xsd/galaxy.xsd Co-Authored-By: Marius van den Beek --- lib/galaxy/tool_util/xsd/galaxy.xsd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/tool_util/xsd/galaxy.xsd b/lib/galaxy/tool_util/xsd/galaxy.xsd index bee920ca8e8..67acdfa2189 100644 --- a/lib/galaxy/tool_util/xsd/galaxy.xsd +++ b/lib/galaxy/tool_util/xsd/galaxy.xsd @@ -1605,7 +1605,7 @@ module. - ``).]]> + ``.]]> From c7faaf49132f44cd27a5b851b9d4ef29adafb3b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gr=C3=BCning?= Date: Thu, 22 Aug 2019 18:00:19 +0200 Subject: [PATCH 6/7] Update lib/galaxy/tool_util/verify/asserts/text.py Co-Authored-By: Marius van den Beek --- lib/galaxy/tool_util/verify/asserts/text.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/tool_util/verify/asserts/text.py b/lib/galaxy/tool_util/verify/asserts/text.py index ee234cf9de1..7faef04914d 100644 --- a/lib/galaxy/tool_util/verify/asserts/text.py +++ b/lib/galaxy/tool_util/verify/asserts/text.py @@ -24,7 +24,7 @@ def assert_has_n_lines(output, n): """Asserts the specified output contains ``n`` lines.""" n_lines_found = len(output.splitlines()) pass - assert counter == int(n), "Expected number of lines (%s) do not match with obtained number ('%s')" % (n, counter) + assert n_lines_found == int(n), "Expected %s lines in output, found %s lines" % (n, n_lines_found) def assert_has_text_matching(output, expression): From 112bcf3989aa95ccf7f5254816753340b47eccf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gr=C3=BCning?= Date: Thu, 22 Aug 2019 19:14:01 +0200 Subject: [PATCH 7/7] Update lib/galaxy/tool_util/verify/asserts/text.py Co-Authored-By: Marius van den Beek --- lib/galaxy/tool_util/verify/asserts/text.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/galaxy/tool_util/verify/asserts/text.py b/lib/galaxy/tool_util/verify/asserts/text.py index 7faef04914d..a82568f63c7 100644 --- a/lib/galaxy/tool_util/verify/asserts/text.py +++ b/lib/galaxy/tool_util/verify/asserts/text.py @@ -23,7 +23,6 @@ def assert_has_line(output, line): def assert_has_n_lines(output, n): """Asserts the specified output contains ``n`` lines.""" n_lines_found = len(output.splitlines()) - pass assert n_lines_found == int(n), "Expected %s lines in output, found %s lines" % (n, n_lines_found)