Add tests for debug commands
continuous-integration/drone the build is pending
Details
continuous-integration/drone the build is pending
Details
Closes #53
This commit is contained in:
parent
6a05aa8083
commit
5f0e6bf18c
|
@ -0,0 +1,53 @@
|
||||||
|
import subprocess
|
||||||
|
from pathlib import Path
|
||||||
|
from tempfile import TemporaryDirectory
|
||||||
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from helpers.datman_helpers import set_up_simple_datman
|
||||||
|
from helpers.yama_helpers import set_up_simple_yama
|
||||||
|
|
||||||
|
|
||||||
|
class TestYamaDebug(TestCase):
|
||||||
|
def test_rmp_fails_if_not_exists(self):
|
||||||
|
td = TemporaryDirectory("test_rmp_fails_if_not_exists")
|
||||||
|
tdpath = Path(td.name)
|
||||||
|
|
||||||
|
datman_path = tdpath.joinpath("datman")
|
||||||
|
yama_path = datman_path.joinpath("main")
|
||||||
|
|
||||||
|
set_up_simple_datman(datman_path)
|
||||||
|
set_up_simple_yama(yama_path)
|
||||||
|
|
||||||
|
proc = subprocess.Popen(
|
||||||
|
("yama", "debug", "rmp", "some_pointer_that_dont_exist"),
|
||||||
|
cwd=yama_path,
|
||||||
|
stderr=subprocess.PIPE,
|
||||||
|
)
|
||||||
|
stderr_data = proc.stderr.read()
|
||||||
|
proc.stderr.close()
|
||||||
|
proc.wait()
|
||||||
|
self.assertNotEqual(proc.returncode, 0)
|
||||||
|
self.assertIn(b"does not exist so can not be deleted", stderr_data)
|
||||||
|
|
||||||
|
td.cleanup()
|
||||||
|
|
||||||
|
def test_lsp_fails_if_not_in_pile(self):
|
||||||
|
td = TemporaryDirectory("test_lsp_fails_if_not_in_pile")
|
||||||
|
tdpath = Path(td.name)
|
||||||
|
|
||||||
|
datman_path = tdpath.joinpath("datman")
|
||||||
|
yama_path = datman_path.joinpath("main")
|
||||||
|
|
||||||
|
set_up_simple_datman(datman_path)
|
||||||
|
set_up_simple_yama(yama_path)
|
||||||
|
|
||||||
|
proc = subprocess.Popen(
|
||||||
|
("yama", "debug", "lsp"), cwd=yama_path.parent, stderr=subprocess.PIPE
|
||||||
|
)
|
||||||
|
stderr_data = proc.stderr.read()
|
||||||
|
proc.stderr.close()
|
||||||
|
proc.wait()
|
||||||
|
self.assertNotEqual(proc.returncode, 0)
|
||||||
|
self.assertIn(b"yama.toml does not exist here", stderr_data)
|
||||||
|
|
||||||
|
td.cleanup()
|
Loading…
Reference in New Issue