-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests for get_installed_modules() utils function
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import nf_core.modules.modules_utils | ||
|
||
from ..test_modules import TestModules | ||
|
||
|
||
class TestModulesUtils(TestModules): | ||
def test_get_installed_modules(self): | ||
"""Test getting installed modules""" | ||
_, nfcore_modules = nf_core.modules.modules_utils.get_installed_modules(self.nfcore_modules) | ||
assert len(nfcore_modules) == 1 | ||
assert nfcore_modules[0].component_name == "bpipe/test" | ||
|
||
def test_get_installed_modules_with_files(self): | ||
"""Test getting installed modules. When a module contains a file in its directory, it shouldn't be picked up as a tool/subtool""" | ||
# Create a file in the module directory | ||
with open(self.nfcore_modules / "modules" / "nf-core" / "bpipe" / "test_file.txt", "w") as fh: | ||
fh.write("test") | ||
|
||
_, nfcore_modules = nf_core.modules.modules_utils.get_installed_modules(self.nfcore_modules) | ||
assert len(nfcore_modules) == 1 |