Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tests/test_cmd_autoupdate.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
CliTestCase,
mark,
skip_if_environ,
skip_if_testtoolshed_down,
skip_if_toolshed_down,
)


Expand Down Expand Up @@ -91,6 +93,7 @@ def test_autoupdate_no_update_needed(self):
assert f"No updates required or made to {xmlfile}." in result.output

@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
@skip_if_toolshed_down
def test_autoupdate_multiple_workflows(self):
"""Test autoupdate command for a workflow is needed."""
with (
Expand Down Expand Up @@ -126,6 +129,7 @@ def test_autoupdate_multiple_workflows(self):

@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
@mark.tests_galaxy_branch
@skip_if_toolshed_down
def test_autoupdate_gxformat2_workflow(self):
with self._isolate_with_test_data("wf_repos/autoupdate_tests") as f:
wf_file = os.path.join(f, "diff-refactor-test.gxwf.yml")
Expand All @@ -144,6 +148,8 @@ def test_autoupdate_gxformat2_workflow(self):
assert wf["release"] == "0.1.1"

@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
@skip_if_toolshed_down
@skip_if_testtoolshed_down
def test_autoupdate_workflow_from_multiple_tool_sheds(self):
with self._isolate_with_test_data("wf_repos/autoupdate_tests") as f:
wf_file = os.path.join(f, "wf_autoupdate_test_multiple_repos.ga")
Expand All @@ -161,6 +167,7 @@ def test_autoupdate_workflow_from_multiple_tool_sheds(self):
assert wf["steps"]["0"]["inputs"][0]["description"] == ""

@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
@skip_if_toolshed_down
def test_autoupdate_workflow_unexisting_version(self):
"""Test autoupdate command for a workflow where the version of the tool is not in the toolshed."""
with self._isolate_with_test_data("wf_repos/autoupdate_tests") as f:
Expand All @@ -172,6 +179,7 @@ def test_autoupdate_workflow_unexisting_version(self):
# In future versions it could be great that it gives the last valid version.

@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
@skip_if_toolshed_down
def test_autoupdate_workflow_unexisting_tool(self):
"""Test autoupdate command for a workflow where the tool is not in the toolshed."""
with self._isolate_with_test_data("wf_repos/autoupdate_tests") as f:
Expand Down
2 changes: 2 additions & 0 deletions tests/test_cmd_serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
run_verbosely,
safe_rmtree,
skip_if_environ,
skip_if_quay_down,
skip_unless_environ,
skip_unless_executable,
target_galaxy_branch,
Expand Down Expand Up @@ -156,6 +157,7 @@ def test_serve_daemon(self):
@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
@skip_unless_executable("docker")
@mark.tests_galaxy_branch
@skip_if_quay_down
def test_serve_interactivetool(self):
self._serve_artifact = os.path.join(TEST_TOOLS_DIR, "interactivetool_simple.xml")
extra_args = [
Expand Down
5 changes: 5 additions & 0 deletions tests/test_cmd_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
PROJECT_TEMPLATES_DIR,
run_verbosely,
skip_if_environ,
skip_if_quay_down,
skip_if_toolshed_down,
skip_unless_module,
TEST_DATA_DIR,
TEST_TOOLS_DIR,
Expand Down Expand Up @@ -95,6 +97,7 @@ def test_data_manager(self):
assert json.load(fh)["summary"]["num_tests"] == 1

@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
@skip_if_quay_down
def test_data_manager_docker_mount(self):
"""Test testing a data manager that needs (ro) access to the test-data folder."""
with self._isolate(), NamedTemporaryFile(prefix="data_manager_test_json") as json_out:
Expand Down Expand Up @@ -281,6 +284,8 @@ def test_workflow_test_collection_inputs(self):
# raise

@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
@skip_if_quay_down
@skip_if_toolshed_down
def test_workflow_test_repository_installation_gxformat2(self):
"""Test testing a workflow with collection inputs Galaxy."""
with self._isolate():
Expand Down
2 changes: 2 additions & 0 deletions tests/test_cmd_training_generate_from_wf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
CliTestCase,
mark,
skip_if_environ,
skip_if_usegalaxy_eu_down,
TEST_DATA_DIR,
)

Expand Down Expand Up @@ -64,6 +65,7 @@ def test_training_generate_from_wf_command_local_wf(self):
shutil.rmtree("topics")

@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
@skip_if_usegalaxy_eu_down
def test_training_generate_from_wf_command_remote_wf(self):
"""Test training_generate_from_wf command with workflow on running instance."""
with self._isolate():
Expand Down
2 changes: 2 additions & 0 deletions tests/test_cmd_training_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
CliTestCase,
mark,
skip_if_environ,
skip_if_usegalaxy_eu_down,
skip_if_zenodo_down,
TEST_DATA_DIR,
)
Expand Down Expand Up @@ -114,6 +115,7 @@ def test_training_init_command_tutorial_local_wf(self):
self._check_exit_code(training_init_command, exit_code=0)

@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
@skip_if_usegalaxy_eu_down
def test_training_init_command_tutorial_remote_wf(self):
"""Test training_init command to create new tutorial with workflow on running instance."""
with self._isolate():
Expand Down
8 changes: 8 additions & 0 deletions tests/test_cmd_workflow_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from .test_utils import (
CliTestCase,
skip_if_toolshed_down,
TEST_DATA_DIR,
)

Expand Down Expand Up @@ -215,6 +216,7 @@ def test_json_value_out(self):
lint_cmd = ["workflow_lint", workflow_path, "--fail_level", "error"]
self._check_exit_code(lint_cmd, exit_code=0)

@skip_if_toolshed_down
def test_tool_id_linting_wrong_version(self):
workflow_path = "/".join(
(TEST_DATA_DIR, "wf_repos", "autoupdate_tests", "workflow_with_unexisting_version_of_tool.ga")
Expand All @@ -226,12 +228,14 @@ def test_tool_id_linting_wrong_version(self):
in result.output
)

@skip_if_toolshed_down
def test_tool_id_linting_wrong_tool(self):
workflow_path = "/".join((TEST_DATA_DIR, "wf_repos", "autoupdate_tests", "workflow_with_unexisting_tool.ga"))
lint_cmd = ["workflow_lint", workflow_path]
result = self._runner.invoke(self._cli.planemo, lint_cmd)
assert "ERROR: The ToolShed returned an error when searching" in result.output

@skip_if_toolshed_down
def test_tool_id_linting_mismatched_changeset(self):
# tp_easyjoin_tool/1.1.0 is a valid tool version, but the pinned
# changeset_revision (288462ec2630) only provides version 1.0.0.
Expand All @@ -245,13 +249,15 @@ def test_tool_id_linting_mismatched_changeset(self):
"is not provided by the pinned changeset_revision 288462ec2630" in result.output
)

@skip_if_toolshed_down
def test_tool_id_linting_matching_changeset(self):
# tp_easyjoin_tool/1.1.0 is provided by changeset_revision 20344ce0c811.
workflow_path = "/".join((TEST_DATA_DIR, "wf_repos", "autoupdate_tests", "workflow_with_matching_changeset.ga"))
lint_cmd = ["workflow_lint", "--skip", "best_practices", workflow_path]
result = self._runner.invoke(self._cli.planemo, lint_cmd)
assert "All tool ids appear to be valid." in result.output

@skip_if_toolshed_down
def test_tool_id_linting_without_tool_shed_repository(self):
# A tool step without a tool_shed_repository has nothing to validate the
# tool_id/version against, so the check is skipped even for an otherwise
Expand All @@ -264,6 +270,7 @@ def test_tool_id_linting_without_tool_shed_repository(self):
assert "not in the toolshed" not in result.output
assert "All tool ids appear to be valid." in result.output

@skip_if_toolshed_down
def test_tool_version_linting_mismatch(self):
# tool_id encodes version 1.1.0 but the step's tool_version is 1.0.0.
workflow_path = "/".join(
Expand All @@ -276,6 +283,7 @@ def test_tool_version_linting_mismatch(self):
"toolshed.g2.bx.psu.edu/repos/bgruening/text_processing/tp_easyjoin_tool/1.1.0" in result.output
)

@skip_if_toolshed_down
def test_tool_version_linting_match(self):
# tool_id and tool_version agree in this fixture.
workflow_path = "/".join((TEST_DATA_DIR, "wf_repos", "autoupdate_tests", "workflow_with_matching_changeset.ga"))
Expand Down
2 changes: 2 additions & 0 deletions tests/test_github_create_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import uuid

import pytest
from galaxy.util.unittest_utils import skip_if_github_down

from planemo import git
from planemo.github_util import (
Expand Down Expand Up @@ -97,6 +98,7 @@ def test_add_dir_contents_to_repo_dry_run():
)


@skip_if_github_down
def test_git_ls_remote():
ctx = create_test_context()
tags_and_commits = git.ls_remote(ctx, "https://github.com/galaxyproject/galaxy")
Expand Down
3 changes: 3 additions & 0 deletions tests/test_lint.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import glob
import os

from galaxy.util.unittest_utils import skip_if_github_down

from .test_utils import (
CliTestCase,
PROJECT_TEMPLATES_DIR,
Expand All @@ -25,6 +27,7 @@ def test_ok_urls(self):
self._check_exit_code(lint_cmd)

@skip_if_environ("PLANEMO_SKIP_SLOW_TESTS")
@skip_if_github_down
def test_ok_http(self):
lint_cmd = [
"lint",
Expand Down
2 changes: 2 additions & 0 deletions tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
CWL_DRAFT3_DIR,
mark,
PROJECT_TEMPLATES_DIR,
skip_if_dockstore_down,
skip_if_environ,
target_galaxy_branch,
TEST_DATA_DIR,
Expand Down Expand Up @@ -276,6 +277,7 @@ def test_run_export_invocation(self):
)
@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
@mark.tests_galaxy_branch
@skip_if_dockstore_down
def test_run_trs_id(self):
"""Test importing and running a workflow using a TRS ID from GitHub."""
with self._isolate() as f:
Expand Down
7 changes: 7 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@
NON_ZERO_EXIT_CODE = object()
ZENODO_TEST_RECORD_API_URL = "https://zenodo.org/api/records/1321885"
skip_if_zenodo_down = skip_if_site_down(ZENODO_TEST_RECORD_API_URL)
# galaxy-util already exports skip_if_github_down/skip_if_workflowhub_down; define the
# rest here until the pinned galaxy-util catches up with galaxyproject/galaxy#23685.
skip_if_dockstore_down = skip_if_site_down("https://dockstore.org/")
skip_if_quay_down = skip_if_site_down("https://quay.io/")
skip_if_toolshed_down = skip_if_site_down("https://toolshed.g2.bx.psu.edu/")
skip_if_testtoolshed_down = skip_if_site_down("https://testtoolshed.g2.bx.psu.edu/")
skip_if_usegalaxy_eu_down = skip_if_site_down("https://usegalaxy.eu/")
CWLTOOL_CACHE_ENV_PROP = "PLANEMO_CWLTOOL_CACHE_DIRECTORY"


Expand Down
Loading