-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The test command tests local copies of files, shed_test resolves repositories, find the latest installed revisions on the shed, installs these revisions in a fresh Galaxy clone, and tests them with ``./run_tests.sh -installed``. Requires galaxyproject/galaxy#267. Closes #176.
- Loading branch information
Showing
9 changed files
with
175 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
""" | ||
""" | ||
import socket | ||
import sys | ||
|
||
import click | ||
|
||
from planemo.cli import pass_context | ||
from planemo import options | ||
from planemo import galaxy_serve | ||
from planemo import shed | ||
from planemo import galaxy_test | ||
|
||
|
||
@click.command("shed_test") | ||
@options.shed_read_options() | ||
@options.galaxy_target_options() | ||
@options.test_options() | ||
@click.option( | ||
"--skip_dependencies", | ||
is_flag=True, | ||
help="Do not install shed dependencies as part of repository installation." | ||
) | ||
@pass_context | ||
def cli(ctx, paths, **kwds): | ||
""" Serve a transient Galaxy instance after installing repositories | ||
from a remote Tool Shed. | ||
""" | ||
galaxy_test.process_test_options(ctx, kwds) | ||
install_args_list = shed.install_arg_lists(ctx, paths, **kwds) | ||
port = get_free_port() | ||
kwds["port"] = port | ||
return_code = 1 | ||
with galaxy_serve.shed_serve(ctx, install_args_list, **kwds) as config: | ||
config.kill() | ||
return_code = galaxy_test.run_in_config( | ||
ctx, | ||
config, | ||
installed=True, | ||
**kwds | ||
) | ||
if return_code: | ||
sys.exit(return_code) | ||
|
||
|
||
def get_free_port(): | ||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | ||
sock.bind(('localhost', 0)) | ||
port = sock.getsockname()[1] | ||
sock.close() | ||
return port |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from .actions import run_in_config | ||
from .options import process_test_options | ||
|
||
__all__ = ["run_in_config"] | ||
__all__ = ["run_in_config", "process_test_options"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import os | ||
|
||
OUTPUT_DFEAULTS = { | ||
"output": "tool_test_output.html", | ||
"output_json": "tool_test_output.json", | ||
"output_xunit": None, | ||
} | ||
|
||
|
||
def process_test_options(ctx, kwds): | ||
for name, default in OUTPUT_DFEAULTS.items(): | ||
_populate_default_output(ctx, name, kwds, default) | ||
|
||
|
||
def _populate_default_output(ctx, type, kwds, default): | ||
kwd_key = "test_%s" % type | ||
kwd_value = kwds.get(kwd_key, None) | ||
if kwd_value is None: | ||
global_config = ctx.global_config | ||
global_config_key = "default_test_%s" % type | ||
if global_config_key in global_config: | ||
default_value = global_config[global_config_key] | ||
else: | ||
default_value = default | ||
|
||
if default_value: | ||
default_value = os.path.abspath(default_value) | ||
kwds[kwd_key] = default_value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import os | ||
|
||
from .test_utils import ( | ||
CliTestCase, | ||
skip_if_environ, | ||
TEST_REPOS_DIR, | ||
) | ||
|
||
|
||
class ShedTestTestCase(CliTestCase): | ||
|
||
@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS") | ||
def test_serve(self): | ||
fastqc_path = os.path.join(TEST_REPOS_DIR, "fastqc") | ||
test_cmd = [ | ||
"shed_test", | ||
"--install_galaxy", | ||
fastqc_path, | ||
] | ||
self._check_exit_code(test_cmd) |