Added SysCommand() tests

This commit is contained in:
Anton Hvornum 2022-05-01 17:18:48 +02:00
parent c69a5ce454
commit 9d6e85e931
1 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,18 @@
import pytest
def test_SysCommand():
import archinstall
import subprocess
if not archinstall.SysCommand('whoami').decode().strip() == subprocess.check_output('whoami').decode().strip():
raise AssertionError(f"SysCommand('whoami') did not return expected output: {subprocess.check_output('whoami').decode()}")
try:
archinstall.SysCommand('nonexistingbinary-for-testing').decode().strip()
except archinstall.RequirementError:
pass # we want to make sure it fails with an exception unique to missing binary
try:
archinstall.SysCommand('ls -veryfaultyparameter').decode().strip()
except archinstall.SysCallError:
pass # We want it to raise a syscall error when a binary dislikes us