mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
with manual fixes to 3 files to make them compatible with black 22.12.0 . We need to keep black pinned at `<23` until we vendorise `packaging`, since the new version of black depends on `packaging >=22.0` which is the version where `LegacyVersion` (which we use for tool lineages) was removed.
68 lines
2.0 KiB
Python
68 lines
2.0 KiB
Python
import os
|
|
import sys
|
|
from typing import (
|
|
List,
|
|
NamedTuple,
|
|
)
|
|
|
|
galaxy_root = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir + "/" + os.path.pardir))
|
|
sys.path[1:1] = [os.path.join(galaxy_root, "lib"), os.path.join(galaxy_root, "test")]
|
|
|
|
import pytest
|
|
|
|
from galaxy_test.api._framework import ApiTestCase
|
|
|
|
SKIPTEST = os.path.join(os.path.dirname(__file__), "known_broken_tools.txt")
|
|
|
|
|
|
class ToolTest(NamedTuple):
|
|
tool_id: str
|
|
tool_version: str
|
|
test_index: int
|
|
|
|
|
|
def get_skiplist():
|
|
with open(SKIPTEST) as skiptest:
|
|
skiplist = [line.strip() for line in skiptest if line.strip() and not line.startswith("#")]
|
|
return skiplist
|
|
|
|
|
|
def get_cases() -> List[ToolTest]:
|
|
atc = ApiTestCase()
|
|
atc.setUpClass()
|
|
atc.setUp()
|
|
test_summary = atc.galaxy_interactor.get_tests_summary()
|
|
test_cases = []
|
|
for tool_id, summary_dict in test_summary.items():
|
|
for tool_version, tool_dict in summary_dict.items():
|
|
for index in range(tool_dict["count"]):
|
|
test_cases.append(ToolTest(tool_id, tool_version, index))
|
|
atc.tearDown()
|
|
atc.tearDownClass()
|
|
return test_cases
|
|
|
|
|
|
def cases():
|
|
skiplist = get_skiplist()
|
|
for tool_test in get_cases():
|
|
marks = []
|
|
marks.append(pytest.mark.skipif(tool_test.tool_id in skiplist, reason="tool in skiplist"))
|
|
if "data_manager_" in tool_test.tool_id:
|
|
marks.append(pytest.mark.data_manager(tool_test))
|
|
else:
|
|
marks.append(pytest.mark.tool(tool_test))
|
|
yield pytest.param(tool_test, marks=marks)
|
|
|
|
|
|
def idfn(val: ToolTest):
|
|
return f"{val.tool_id}/{val.tool_version}-{val.test_index}"
|
|
|
|
|
|
class TestFrameworkTools(ApiTestCase):
|
|
conda_auto_init = True
|
|
conda_auto_install = True
|
|
|
|
@pytest.mark.parametrize("testcase", cases(), ids=idfn)
|
|
def test_tool(self, testcase: ToolTest):
|
|
self._test_driver.run_tool_test(testcase.tool_id, testcase.test_index, tool_version=testcase.tool_version)
|