Skip to content

Commit

Permalink
add test for the main app
Browse files Browse the repository at this point in the history
  • Loading branch information
cokelaer committed Aug 5, 2020
1 parent 82957a7 commit beb62ac
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
15 changes: 6 additions & 9 deletions damona/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,22 @@ def __init__(self):
self.discovery()

def _read_registry(self, registry):
if os.path.exists(registry) is False:
if os.path.exists(registry) is False: #pragma: no cover
raise IOError("incorrect input filename {}".format(registry))

# read the yaml
data = yaml.load(open(registry, "r").read(), Loader=Loader)

# some checks
for k, v in data.items():
if "class" not in v:
if "class" not in v: #pragma: no cover
logger.warning("missing class in {}".format(registry))
if "version" not in v:
if "version" not in v: #pragma: no cover
logger.warning("missing version in {}".format(registry))
if "download" not in v:
if "download" not in v: #pragma: no cover
logger.warning("missing download in {}".format(registry))
if data[k]["class"] == "exe":
if "binaries" not in v:
if "binaries" not in v: #pragma: no cover
logger.warning("missing binaries field in {}".format(registry))
return data

Expand All @@ -79,12 +79,9 @@ def discovery(self):

for filename in self._singularity_files:
p = pathlib.Path(filename)
if (p.parent / "registry.yaml").exists() is False:
if (p.parent / "registry.yaml").exists() is False: #pragma: no cover
logger.warning("Missing registry in {}. You may use 'damona registry {} to start with".format(p.parent, p.parent))

def get_downloadable_link(self, name):
pass

def create_registry(self, path):
#recipes = glob.glob(pathlib.Path(path).absolute() / "Singularity*")
recipes = glob.glob(path + "/Singularity*")
Expand Down
9 changes: 8 additions & 1 deletion test/test_damona.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
import subprocess


def test_damona_app():
from click.testing import CliRunner
from damona.script import install
runner = CliRunner()
results = runner.invoke(install, ['fastqc:0.11.9', '--dryrun'])
assert results.exit_code == 0

def test_python_pull():
p = pull.Pull(dryrun=True)
p.pull("fastqc:0.11.9")
Expand Down Expand Up @@ -35,7 +42,7 @@ def test_list():
cmd = "damona list --help"
subprocess.call(cmd.split())

cmd = "damona list"
cmd = "damona list --pattern qc"
subprocess.call(cmd.split())

def test_develop():
Expand Down

0 comments on commit beb62ac

Please sign in to comment.