Embed integration tests into pytest.

This commit is contained in:
Sergey Vartanov 2021-09-10 00:39:22 +03:00
parent c3222e36be
commit 2bd22abcb4

View file

@ -0,0 +1,23 @@
"""
Test command line commands.
"""
from subprocess import PIPE, Popen
__author__ = "Sergey Vartanov"
__email__ = "me@enzet.ru"
def error_run(arguments: list[str], message: bytes) -> None:
"""Run command that should fail and check error message."""
p = Popen(["map-machine"] + arguments, stderr=PIPE)
_, error = p.communicate()
assert p.returncode != 0
assert error == message
def run(arguments: list[str], message: bytes) -> None:
"""Run command that should fail and check error message."""
p = Popen(["map-machine"] + arguments, stderr=PIPE)
_, error = p.communicate()
assert p.returncode == 0
assert error == message