-
Notifications
You must be signed in to change notification settings - Fork 88
/
Copy pathtest_cmd_test_conda.py
98 lines (90 loc) · 3.49 KB
/
test_cmd_test_conda.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
"""Module contains :class:`CmdTestTestCase` - integration tests for the ``test`` command."""
import os
from .test_utils import (
CliTestCase,
mark,
PROJECT_TEMPLATES_DIR,
skip_if_environ,
target_galaxy_branch,
TEST_REPOS_DIR,
TEST_TOOLS_DIR,
)
class CmdTestCondaTestCase(CliTestCase):
"""Integration tests for the ``test`` command."""
@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
@mark.tests_galaxy_branch
def test_conda_dependencies_by_default(self):
with self._isolate():
bwa_test = os.path.join(PROJECT_TEMPLATES_DIR, "conda_testing", "bwa.xml")
test_command = [
"--verbose",
"test",
"--galaxy_branch",
target_galaxy_branch(),
bwa_test,
]
self._check_exit_code(test_command, exit_code=0)
@skip_if_environ("PLANEMO_SKIP_REDUNDANT_TESTS") # same code path as test above.
@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
def test_conda_dependencies_explicit_resolution(self):
with self._isolate():
bwa_test = os.path.join(PROJECT_TEMPLATES_DIR, "conda_testing", "bwa.xml")
test_command = [
"--verbose",
"test",
"--conda_dependency_resolution",
"--conda_auto_install",
"--conda_auto_init",
bwa_test,
]
self._check_exit_code(test_command, exit_code=0)
@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
@mark.tests_galaxy_branch
def test_conda_dependencies_version(self):
"""Test tool with wrong version and ensure it fails."""
with self._isolate():
# Try a failing test to ensure the primary test above isn't just passing spuriously.
bwa_test = os.path.join(TEST_TOOLS_DIR, "bwa_wrong_version.xml")
test_command = [
"--verbose",
"test",
"--galaxy_branch",
target_galaxy_branch(),
"--conda_dependency_resolution",
"--conda_auto_install",
"--conda_auto_init",
bwa_test,
]
self._check_exit_code(test_command, exit_code=1)
@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
@mark.tests_galaxy_branch
def test_local_conda_dependencies_version(self):
"""Test a tool that requires local package builds."""
with self._isolate() as isolated_dir:
conda_prefix = os.path.join(isolated_dir, "miniconda3")
fleeqtk_recipe = os.path.join(PROJECT_TEMPLATES_DIR, "conda_answers", "exercise_2", "fleeqtk")
build_command = [
"conda_build",
"--conda_prefix",
conda_prefix,
fleeqtk_recipe,
]
self._check_exit_code(build_command)
fleeqtk_tool = os.path.join(TEST_REPOS_DIR, "conda_exercises_fleeqtk", "fleeqtk_seq.xml")
conda_install_command = [
"conda_install",
"--conda_prefix",
conda_prefix,
"--conda_use_local",
fleeqtk_tool,
]
self._check_exit_code(conda_install_command)
test_command = [
"test",
"--galaxy_branch",
target_galaxy_branch(),
"--conda_prefix",
conda_prefix,
fleeqtk_tool,
]
self._check_exit_code(test_command)