|
1 | 1 | import os |
2 | 2 |
|
3 | 3 | import pytest |
4 | | -import responses |
5 | 4 |
|
6 | 5 | import nf_core.modules |
7 | | -from tests.utils import mock_api_calls |
8 | 6 |
|
9 | 7 |
|
10 | 8 | def test_modules_create_succeed(self): |
11 | 9 | """Succeed at creating the TrimGalore! module""" |
12 | | - with responses.RequestsMock() as rsps: |
13 | | - mock_api_calls(rsps, "trim-galore", "0.6.7") |
14 | | - module_create = nf_core.modules.ModuleCreate( |
15 | | - self.pipeline_dir, "trimgalore", "@author", "process_single", True, True, conda_name="trim-galore" |
16 | | - ) |
17 | | - module_create.create() |
| 10 | + # FIXME This should use the mock? |
| 11 | + module_create = nf_core.modules.ModuleCreate( |
| 12 | + self.pipeline_dir, "trimgalore", "@author", "process_single", True, True, conda_name="trim-galore" |
| 13 | + ) |
| 14 | + module_create.create() |
18 | 15 | assert os.path.exists(os.path.join(self.pipeline_dir, "modules", "local", "trimgalore.nf")) |
19 | 16 |
|
20 | 17 |
|
21 | 18 | def test_modules_create_fail_exists(self): |
22 | 19 | """Fail at creating the same module twice""" |
23 | | - with responses.RequestsMock() as rsps: |
24 | | - mock_api_calls(rsps, "trim-galore", "0.6.7") |
25 | | - module_create = nf_core.modules.ModuleCreate( |
26 | | - self.pipeline_dir, "trimgalore", "@author", "process_single", False, False, conda_name="trim-galore" |
27 | | - ) |
| 20 | + # FIXME This should use the mock? |
| 21 | + module_create = nf_core.modules.ModuleCreate( |
| 22 | + self.pipeline_dir, "trimgalore", "@author", "process_single", False, False, conda_name="trim-galore" |
| 23 | + ) |
| 24 | + module_create.create() |
| 25 | + with pytest.raises(UserWarning) as excinfo: |
28 | 26 | module_create.create() |
29 | | - with pytest.raises(UserWarning) as excinfo: |
30 | | - module_create.create() |
31 | 27 | assert "Module file exists already" in str(excinfo.value) |
32 | 28 |
|
33 | 29 |
|
34 | 30 | def test_modules_create_nfcore_modules(self): |
35 | 31 | """Create a module in nf-core/modules clone""" |
36 | | - with responses.RequestsMock() as rsps: |
37 | | - mock_api_calls(rsps, "fastqc", "0.11.9") |
38 | | - module_create = nf_core.modules.ModuleCreate( |
39 | | - self.nfcore_modules, "fastqc", "@author", "process_low", False, False |
40 | | - ) |
41 | | - module_create.create() |
| 32 | + # FIXME This should use the mock? |
| 33 | + module_create = nf_core.modules.ModuleCreate(self.nfcore_modules, "fastqc", "@author", "process_low", False, False) |
| 34 | + module_create.create() |
42 | 35 | assert os.path.exists(os.path.join(self.nfcore_modules, "modules", "nf-core", "fastqc", "main.nf")) |
43 | 36 | assert os.path.exists(os.path.join(self.nfcore_modules, "tests", "modules", "nf-core", "fastqc", "main.nf")) |
44 | 37 |
|
45 | 38 |
|
46 | 39 | def test_modules_create_nfcore_modules_subtool(self): |
47 | 40 | """Create a tool/subtool module in a nf-core/modules clone""" |
48 | | - with responses.RequestsMock() as rsps: |
49 | | - mock_api_calls(rsps, "star", "2.8.10a") |
50 | | - module_create = nf_core.modules.ModuleCreate( |
51 | | - self.nfcore_modules, "star/index", "@author", "process_medium", False, False |
52 | | - ) |
53 | | - module_create.create() |
| 41 | + # FIXME This should use the mock? |
| 42 | + module_create = nf_core.modules.ModuleCreate( |
| 43 | + self.nfcore_modules, "star/index", "@author", "process_medium", False, False |
| 44 | + ) |
| 45 | + module_create.create() |
54 | 46 | assert os.path.exists(os.path.join(self.nfcore_modules, "modules", "nf-core", "star", "index", "main.nf")) |
55 | 47 | assert os.path.exists(os.path.join(self.nfcore_modules, "tests", "modules", "nf-core", "star", "index", "main.nf")) |
0 commit comments