Skip to content
Snippets Groups Projects
Commit 62c283c7 authored by mjbonifa's avatar mjbonifa
Browse files

changed acmc.py to main.py, convention for cli tool

parent 74fe2c40
Branches
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@ from pathlib import Path
import trud
import omop
import phen
import acmc
import main
# setup logging
from logging_config import setup_logger
......@@ -35,29 +35,29 @@ def logger():
def test_phen_init_local_default(tmp_dir, monkeypatch, caplog):
with caplog.at_level(logging.DEBUG):
monkeypatch.setattr(sys, "argv", ["acmc.py", "phen", "init"])
monkeypatch.setattr(sys, "argv", ["main.py", "phen", "init"])
# Mock input() to return "yes" to the question about reinitialising the directory
monkeypatch.setattr("builtins.input", lambda _: "y")
acmc.main()
main.main()
assert "Phenotype initialised successfully" in caplog.text
def test_phen_init_local_specified(tmp_dir, monkeypatch, caplog):
with caplog.at_level(logging.DEBUG):
phen_path = tmp_dir / "phen"
monkeypatch.setattr(sys, "argv", ["acmc.py", "phen", "init", "-d", str(phen_path.resolve())])
monkeypatch.setattr(sys, "argv", ["main.py", "phen", "init", "-d", str(phen_path.resolve())])
# Mock input() to return "yes" to the question about reinitialising the directory
monkeypatch.setattr("builtins.input", lambda _: "y")
acmc.main()
main.main()
assert "Phenotype initialised successfully" in caplog.text
def test_phen_workflow(tmp_dir, monkeypatch, caplog):
with caplog.at_level(logging.DEBUG):
phen_path = tmp_dir / "phen"
phen_path = phen_path.resolve()
monkeypatch.setattr(sys, "argv", ["acmc.py", "phen", "init", "-d", str(phen_path.resolve())])
monkeypatch.setattr(sys, "argv", ["main.py", "phen", "init", "-d", str(phen_path.resolve())])
# Mock input() to return "yes" to the question about reinitialising the directory
monkeypatch.setattr("builtins.input", lambda _: "y")
acmc.main()
main.main()
assert "Phenotype initialised successfully" in caplog.text
with caplog.at_level(logging.DEBUG):
......@@ -74,31 +74,31 @@ def test_phen_workflow(tmp_dir, monkeypatch, caplog):
shutil.copy(source, destination)
shutil.copy( phen_path / 'config1.json', phen_path / 'config.json')
monkeypatch.setattr(sys, "argv", ["acmc.py", "phen", "validate", "-d", str(phen_path.resolve())])
acmc.main()
monkeypatch.setattr(sys, "argv", ["main.py", "phen", "validate", "-d", str(phen_path.resolve())])
main.main()
assert "Phenotype validated successfully" in caplog.text
# map phenotype
with caplog.at_level(logging.DEBUG):
monkeypatch.setattr(sys, "argv", ["acmc.py", "phen", "map", "-d", str(phen_path.resolve()), "-t", "read2", "-tr", "-ve"])
acmc.main()
monkeypatch.setattr(sys, "argv", ["main.py", "phen", "map", "-d", str(phen_path.resolve()), "-t", "read2", "-tr", "-ve"])
main.main()
assert "Phenotype processed successfully" in caplog.text
# publish phenotype
with caplog.at_level(logging.DEBUG):
monkeypatch.setattr(sys, "argv", ["acmc.py", "phen", "publish", "-d", str(phen_path.resolve())])
acmc.main()
monkeypatch.setattr(sys, "argv", ["main.py", "phen", "publish", "-d", str(phen_path.resolve())])
main.main()
assert "Phenotype published successfully" in caplog.text
# copy phenotype'
with caplog.at_level(logging.DEBUG):
monkeypatch.setattr(sys, "argv", ["acmc.py", "phen", "copy", "-d", str(phen_path.resolve()), "-td", str(tmp_dir.resolve()), "-v", "v1.0.3"])
acmc.main()
monkeypatch.setattr(sys, "argv", ["main.py", "phen", "copy", "-d", str(phen_path.resolve()), "-td", str(tmp_dir.resolve()), "-v", "v1.0.3"])
main.main()
assert "Phenotype copied successfully" in caplog.text
# diff phenotype
with caplog.at_level(logging.DEBUG):
old_path = tmp_dir / "v1.0.3"
monkeypatch.setattr(sys, "argv", ["acmc.py", "phen", "diff", "-d", str(phen_path.resolve()), "-old", str(old_path.resolve())])
acmc.main()
monkeypatch.setattr(sys, "argv", ["main.py", "phen", "diff", "-d", str(phen_path.resolve()), "-old", str(old_path.resolve())])
main.main()
assert "Phenotypes diff'd successfully" in caplog.text
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment