mirror of https://github.com/Nonannet/copapy.git
run_command function for tests adjusted
This commit is contained in:
parent
b5e6130eb8
commit
f09ca81a61
|
|
@ -5,12 +5,10 @@ import struct
|
||||||
from copapy import binwrite
|
from copapy import binwrite
|
||||||
|
|
||||||
|
|
||||||
def run_command(command: list[str], encoding: str = 'utf8') -> str:
|
def run_command(command: list[str]) -> str:
|
||||||
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf8', check=False)
|
||||||
output, error = process.communicate()
|
assert result.returncode == 0, f"\n -Error occurred: {result.stderr}\n -Output: {result.stdout}"
|
||||||
|
return result.stdout
|
||||||
assert not error, f"\n -Error occurred: {error.decode(encoding)}\n -Output: {output.decode(encoding)}"
|
|
||||||
return output.decode(encoding)
|
|
||||||
|
|
||||||
|
|
||||||
def test_example():
|
def test_example():
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue