mirror of
https://github.com/enzet/map-machine.git
synced 2025-05-23 22:16:25 +02:00
Embed integration tests into pytest.
This commit is contained in:
parent
c3222e36be
commit
2bd22abcb4
1 changed files with 23 additions and 0 deletions
23
tests/test_command_line.py
Normal file
23
tests/test_command_line.py
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue