-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclio_test.py.jinja
More file actions
55 lines (42 loc) · 1.45 KB
/
clio_test.py.jinja
File metadata and controls
55 lines (42 loc) · 1.45 KB
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
"""Set of standard clio tests.
DO NOT MANUALLY MODIFY THIS FILE!
It should be updated through our templating functions.
"""
import subprocess
from pathlib import Path
import pytest
from clio_tools.data_module import ModuleInterface
@pytest.fixture(scope="module")
def module_path():
"""Parent directory of the project."""
return Path(__file__).parent.parent
def test_interface_file(module_path):
"""The interfacing file should be correct."""
assert ModuleInterface.from_yaml(module_path / "INTERFACE.yaml")
@pytest.mark.parametrize(
"file",
[
"CITATION.cff",
"AUTHORS",
"INTERFACE.yaml",
"LICENSE",
"tests/integration/Snakefile",
],
)
def test_standard_file_existance(module_path, file):
"""Check that a minimal set of files used for clio automatic docs are present."""
assert Path(module_path / file).exists()
def test_snakemake_all_failure(module_path):
"""The snakemake 'all' rule should return an error by default."""
process = subprocess.run(
"snakemake --cores 1", shell=True, cwd=module_path, capture_output=True
)
assert "INVALID (missing locally)" in str(process.stderr)
def test_snakemake_integration_testing(module_path):
"""Run a light-weight test simulating someone using this module."""
assert subprocess.run(
"snakemake --use-conda --cores 1",
shell=True,
check=True,
cwd=module_path / "tests/integration",
)