From fb21909dadaed688ae027313cea34bfe065772f5 Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Tue, 7 Jul 2020 23:38:12 -0700 Subject: [PATCH] invoke/poetry: updated version in toml file and added invoke commands --- daemon/pyproject.toml | 2 +- tasks.py | 52 +++++++++++++++++++++++++++++++++++++------ 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/daemon/pyproject.toml b/daemon/pyproject.toml index 6df5f10e..609fcb08 100644 --- a/daemon/pyproject.toml +++ b/daemon/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "core" -version = "6.4.0" +version = "6.6.0" description = "" authors = [] diff --git a/tasks.py b/tasks.py index 74e6af76..b19e8925 100644 --- a/tasks.py +++ b/tasks.py @@ -2,13 +2,51 @@ from invoke import task @task -def core(c): - c.run( - "poetry run sudo python3 scripts/core-daemon " - "-f data/core.conf -l data/logging.conf" - ) +def daemon(c): + """ + Runs core-daemon. + """ + with c.cd("daemon"): + poetry = c.run("which poetry").stdout.strip() + c.run( + f"sudo {poetry} run scripts/core-daemon " + "-f data/core.conf -l data/logging.conf" + ) @task -def core_pygui(c): - c.run("poetry run python3 scripts/core-pygui") +def gui(c): + """ + Run core-pygui. + """ + with c.cd("daemon"): + c.run("poetry run scripts/core-pygui") + + +@task +def test(c): + """ + Run core tests. + """ + with c.cd("daemon"): + poetry = c.run("which poetry").stdout.strip() + c.run(f"sudo {poetry} run pytest -v --lf -x tests", pty=True) + + +@task +def test_mock(c): + """ + Run core tests using mock to avoid running as sudo. + """ + with c.cd("daemon"): + c.run("poetry run pytest -v --mock --lf -x tests", pty=True) + + +@task +def test_emane(c): + """ + Run core emane tests. + """ + with c.cd("daemon"): + poetry = c.run("which poetry").stdout.strip() + c.run(f"sudo {poetry} run pytest -v --lf -x tests/emane", pty=True)