Skip to content

Commit 86a8c6a

Browse files
committed
Improve how various branches of Galaxy are testing.
Annotate tests that include a significant aspect of Galaxy behavior testing and paramerize them to allow overridding the target branch via an environment variable. By default switch all of these to test master, but create new tox profiles and Travis targets that only run these tests and run for other branches (dev, release_18.01, and release_17.09 currently). Also drop the py27-quick set of tests from Travis - going to be future facing and be happy with the python 3 tests for the quick turn around / stable tests.
1 parent 1601813 commit 86a8c6a

8 files changed

Lines changed: 66 additions & 17 deletions

File tree

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ env:
66
- TOX_ENV=py34-lint
77
- TOX_ENV=py27-lint-readme
88
- TOX_ENV=py27-lint-docs
9-
- TOX_ENV=py27-quick
109
- TOX_ENV=py34-quick
1110
- TOX_ENV=py27
1211
- TOX_ENV=py34
12+
- TOX_ENV=py34-gx-1801
13+
- TOX_ENV=py34-gx-dev
14+
- TOX_ENV=py34-gx-1709
1315
- TOX_ENV=py27-lint-docstrings
1416

1517
install:

tests/test_cmd_serve.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
cli_daemon_service,
1010
CliTestCase,
1111
launch_and_wait_for_service,
12+
mark,
1213
PROJECT_TEMPLATES_DIR,
1314
skip_if_environ,
1415
skip_unless_environ,
16+
target_galaxy_branch,
1517
TEST_DATA_DIR,
1618
TEST_REPOS_DIR,
1719
)
@@ -22,10 +24,12 @@
2224
class ServeTestCase(CliTestCase):
2325

2426
@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
27+
@mark.tests_galaxy_branch
2528
def test_serve(self):
2629
self._launch_thread_and_wait(self._run)
2730

2831
@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
32+
@mark.tests_galaxy_branch
2933
def test_serve_daemon(self):
3034
extra_args = ["--daemon", "--pid_file", self._pid_file]
3135
self._launch_thread_and_wait(self._run, extra_args)
@@ -35,6 +39,7 @@ def test_serve_daemon(self):
3539
kill_pid_file(self._pid_file)
3640

3741
@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
42+
@mark.tests_galaxy_branch
3843
def test_serve_workflow(self):
3944
random_lines = os.path.join(PROJECT_TEMPLATES_DIR, "demo", "randomlines.xml")
4045
cat = os.path.join(PROJECT_TEMPLATES_DIR, "demo", "cat.xml")
@@ -54,6 +59,7 @@ def test_serve_workflow(self):
5459
assert len(user_gi.workflows.get_workflows()) == 1
5560

5661
@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
62+
@mark.tests_galaxy_branch
5763
def test_shed_serve(self):
5864
extra_args = ["--daemon", "--pid_file", self._pid_file, "--shed_target", "toolshed"]
5965
fastqc_path = os.path.join(TEST_REPOS_DIR, "fastqc")
@@ -124,7 +130,7 @@ def _run(self, serve_args=[], serve_cmd="serve"):
124130
def _serve_command_list(self, serve_args=[], serve_cmd="serve"):
125131
test_cmd = [
126132
serve_cmd,
127-
"--install_galaxy",
133+
"--galaxy_branch", target_galaxy_branch(),
128134
"--no_dependency_resolution",
129135
"--port",
130136
str(self._port),

tests/test_cmd_test_conda.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33

44
from .test_utils import (
55
CliTestCase,
6+
mark,
67
PROJECT_TEMPLATES_DIR,
78
skip_if_environ,
9+
target_galaxy_branch,
810
TEST_REPOS_DIR,
911
TEST_TOOLS_DIR,
1012
)
@@ -14,13 +16,14 @@ class CmdTestCondaTestCase(CliTestCase):
1416
"""Integration tests for the ``test`` command."""
1517

1618
@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
19+
@mark.tests_galaxy_branch
1720
def test_conda_dependencies_by_default(self):
1821
with self._isolate():
1922
bwa_test = os.path.join(PROJECT_TEMPLATES_DIR, "conda_testing", "bwa.xml")
2023
test_command = [
2124
"--verbose",
2225
"test",
23-
"--galaxy_branch", "dev",
26+
"--galaxy_branch", target_galaxy_branch(),
2427
bwa_test,
2528
]
2629
self._check_exit_code(test_command, exit_code=0)
@@ -41,6 +44,7 @@ def test_conda_dependencies_explicit_resolution(self):
4144
self._check_exit_code(test_command, exit_code=0)
4245

4346
@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
47+
@mark.tests_galaxy_branch
4448
def test_conda_dependencies_version(self):
4549
"""Test tool with wrong version and ensure it fails."""
4650
with self._isolate():
@@ -49,6 +53,7 @@ def test_conda_dependencies_version(self):
4953
test_command = [
5054
"--verbose",
5155
"test",
56+
"--galaxy_branch", target_galaxy_branch(),
5257
"--conda_dependency_resolution",
5358
"--conda_auto_install",
5459
"--conda_auto_init",
@@ -57,6 +62,7 @@ def test_conda_dependencies_version(self):
5762
self._check_exit_code(test_command, exit_code=1)
5863

5964
@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
65+
@mark.tests_galaxy_branch
6066
def test_local_conda_dependencies_version(self):
6167
"""Test a tool that requires local package builds."""
6268
with self._isolate():
@@ -75,7 +81,7 @@ def test_local_conda_dependencies_version(self):
7581
self._check_exit_code(conda_install_command)
7682
test_command = [
7783
"test",
78-
"--galaxy_branch", "release_17.09",
84+
"--galaxy_branch", target_galaxy_branch(),
7985
fleeqtk_tool,
8086
]
8187
self._check_exit_code(test_command)

tests/test_galaxy_serve.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def test_serve_daemon(self):
5050
timeout=.1,
5151
)
5252

53+
@skip_if_environ("PLANEMO_SKIP_REDUNDANT_TESTS") # redundant with test_cmd_serve -> test_serve_workflow
5354
@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
5455
def test_serve_workflow(self):
5556
"""Test serving a galaxy workflow via a daemon Galaxy process."""

tests/test_init_and_test.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
from .test_utils import (
22
CliTestCase,
3+
mark,
34
skip_if_environ,
5+
target_galaxy_branch,
46
)
57

68

79
class InitAndTestTestCase(CliTestCase):
810

911
@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
10-
def test_init_and_test_master(self):
11-
self.__run_commands()
12-
13-
@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
14-
def test_init_and_test_dev(self):
15-
self.__run_commands(test_args=["--galaxy_branch", "dev"])
16-
17-
def __run_commands(self, test_args=[]):
12+
@mark.tests_galaxy_branch
13+
def test_init_and_test(self):
1814
with self._isolate():
1915
init_cmd = ["project_init", "--template", "demo", "basic"]
2016
self._check_exit_code(init_cmd)
21-
test_cmd = ["test", "--install_galaxy"] + test_args
22-
test_cmd += ["basic/cat.xml"]
17+
test_cmd = [
18+
"test",
19+
"--no_dependency_resolution",
20+
"--galaxy_branch", target_galaxy_branch(),
21+
"basic/cat.xml"
22+
]
2323
self._check_exit_code(test_cmd)

tests/test_run.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
from .test_utils import (
55
CliTestCase,
66
CWL_DRAFT3_DIR,
7+
mark,
78
PROJECT_TEMPLATES_DIR,
89
skip_if_environ,
10+
target_galaxy_branch,
911
TEST_DATA_DIR,
1012
)
1113

@@ -48,6 +50,7 @@ def test_run_cat_cwltool_more_options(self):
4850
self._check_exit_code(test_cmd)
4951

5052
@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
53+
@mark.tests_galaxy_branch
5154
def test_run_gxtool_randomlines(self):
5255
with self._isolate():
5356
tool_path = os.path.join(PROJECT_TEMPLATES_DIR, "demo", "randomlines.xml")
@@ -56,6 +59,7 @@ def test_run_gxtool_randomlines(self):
5659
"--verbose",
5760
"run",
5861
"--no_dependency_resolution",
62+
"--galaxy_branch", target_galaxy_branch(),
5963
tool_path,
6064
job_path,
6165
]

tests/test_utils.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
setup_mock_shed,
2525
)
2626

27+
try:
28+
import pytest
29+
except ImportError:
30+
pytest = None
31+
from nose.plugins.attrib import attr
32+
2733
if version_info < (2, 7):
2834
from unittest2 import TestCase, skip
2935
PRE_PYTHON_27 = True
@@ -47,6 +53,18 @@
4753
NON_ZERO_EXIT_CODE = object()
4854

4955

56+
class MarkGenerator(object):
57+
58+
def __getattr__(self, name):
59+
if pytest:
60+
return getattr(pytest.mark, name)
61+
else:
62+
return attr(name)
63+
64+
65+
mark = MarkGenerator()
66+
67+
5068
# More information on testing click applications at following link.
5169
# http://click.pocoo.org/3/testing/#basic-testing
5270
class CliTestCase(TestCase):
@@ -203,6 +221,10 @@ def skip_unless_python_2_7():
203221
return skip("Python 2.7 required for test.")
204222

205223

224+
def target_galaxy_branch():
225+
return os.environ.get("PLANEMO_TEST_GALAXY_BRANCH", "master")
226+
227+
206228
def test_context():
207229
context = cli.Context()
208230
context.planemo_directory = "/tmp/planemo-test-workspace"

tox.ini

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# TODO: implement doc linting
22
[tox]
3-
envlist = py{27,34}-lint, py{27,34,35}-quick, py27-lint-imports, py27-lint-docstrings, py27-lint-readme, py27-lint-docs, py{27,34,35}
3+
envlist = py{27,34}-lint, py{27,34,35}-quick, py27-lint-imports, py27-lint-docstrings, py27-lint-readme, py27-lint-docs, py{27,34,35}, py{27,34,35}-gx-{master,dev,1801,1709,1705}
44
source_dir = planemo
55
test_dir = tests
66

77
[testenv]
8-
commands = {envpython} setup.py nosetests []
9-
passenv = PLANEMO_*
8+
commands = nosetests
9+
passenv =
10+
PLANEMO_*
11+
NOSE_*
1012
deps =
1113
-rrequirements.txt
1214
nose
@@ -15,6 +17,12 @@ deps =
1517
setenv =
1618
quick: PLANEMO_SKIP_SLOW_TESTS=1
1719
quick: PLANEMO_SKIP_GALAXY_TESTS=1
20+
gx: NOSE_ATTR=tests_galaxy_branch
21+
master: PLANEMO_TEST_GALAXY_BRANCH=master
22+
dev: PLANEMO_TEST_GALAXY_BRANCH=dev
23+
1801: PLANEMO_TEST_GALAXY_BRANCH=release_18.01
24+
1709: PLANEMO_TEST_GALAXY_BRANCH=release_17.09
25+
1705: PLANEMO_TEST_GALAXY_BRANCH=release_17.05
1826

1927
[testenv:py27-lint]
2028
commands = flake8 {[tox]source_dir} {[tox]test_dir}

0 commit comments

Comments
 (0)