Restructure unit tests for tool_util package

This replaces a previous (now closed) PR:
https://github.com/galaxyproject/galaxy/pull/8279

A few changes:
- tests for code in galaxy/tool_util moved under test/unit/tool_util
- common parts (used in both tools and tool_util) factored out into
  unittest_utils/sample_data.py
- symlink to sample_data.py in test/unit/tool_util/ is needed to make
  the tool_util package tests run. This is not an ideal solution, but it
  avoids duplication of the sample data used by tests in tools/ and
  tool_util/.
This commit is contained in:
Sergey Golitsynskiy
2019-07-16 20:15:45 -04:00
parent f7b37516d7
commit 0e4e1d9249
19 changed files with 28 additions and 28 deletions
+1
View File
@@ -0,0 +1 @@
../../../test/unit/unittest_utils/sample_data.py
@@ -1 +1 @@
../../../test/unit/tools/test_conda_resolution.py
../../../test/unit/tool_util/test_conda_resolution.py
@@ -1 +1 @@
../../../test/unit/tools/test_output_checker.py
../../../test/unit/tool_util/test_output_checker.py
+1 -1
View File
@@ -1 +1 @@
../../../test/unit/tools/test_parsing.py
../../../test/unit/tool_util/test_parsing.py
+1 -1
View File
@@ -1 +1 @@
../../../test/unit/tools/test_tool_deps.py
../../../test/unit/tool_util/test_tool_deps.py
+1 -1
View File
@@ -1 +1 @@
../../../test/unit/tools/test_tool_loader.py
../../../test/unit/tool_util/test_tool_loader.py
+1
View File
@@ -0,0 +1 @@
../../../test/unit/tool_util/test_util.py
+1 -1
View File
@@ -1 +1 @@
../../../test/unit/tools/util.py
../../../test/unit/tool_util/util.py
View File
+1
View File
@@ -0,0 +1 @@
../unittest_utils/sample_data.py
@@ -1,27 +1,10 @@
import os
from shutil import rmtree
from string import Template
from tempfile import mkdtemp
from galaxy.tool_util.loader import load_tool, template_macro_params
from galaxy.util import parse_xml
SIMPLE_TOOL_WITH_MACRO = """<tool id="tool_with_macro" name="macro_annotation" version="@WRAPPER_VERSION@">
<expand macro="inputs" />
<macros>
<import>external.xml</import>
</macros>
</tool>"""
SIMPLE_MACRO = Template("""
<macros>
<token name="@WRAPPER_VERSION@">$tool_version</token>
<macro name="inputs">
<inputs/>
</macro>
</macros>
""")
from .sample_data import SIMPLE_TOOL_WITH_MACRO, SIMPLE_MACRO
def test_loader():
+1 -4
View File
@@ -14,12 +14,9 @@ from galaxy.model import tool_shed_install
from galaxy.model.tool_shed_install import mapping
from galaxy.tools import ToolBox
from galaxy.tools.cache import ToolCache
from .test_tool_loader import (
SIMPLE_MACRO,
SIMPLE_TOOL_WITH_MACRO
)
from .test_toolbox_filters import mock_trans
from ..tools_support import UsesApp, UsesTools
from ..unittest_utils.sample_data import SIMPLE_TOOL_WITH_MACRO, SIMPLE_MACRO
log = logging.getLogger(__name__)
+17
View File
@@ -0,0 +1,17 @@
from string import Template
SIMPLE_TOOL_WITH_MACRO = """<tool id="tool_with_macro" name="macro_annotation" version="@WRAPPER_VERSION@">
<expand macro="inputs" />
<macros>
<import>external.xml</import>
</macros>
</tool>"""
SIMPLE_MACRO = Template("""
<macros>
<token name="@WRAPPER_VERSION@">$tool_version</token>
<macro name="inputs">
<inputs/>
</macro>
</macros>
""")