From 6b717dba0be3fd230f3b26a666d59fdfe2e275cb Mon Sep 17 00:00:00 2001 From: "Johan B.W. de Vries" Date: Sat, 7 May 2022 12:14:34 +0200 Subject: [PATCH] Fix pathing issue when wat2wasm is not globally installed --- Makefile | 2 +- tests/integration/helpers.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index eef7502..36d0f06 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ server: python3.8 -m http.server test: venv/.done - venv/bin/pytest tests $(TEST_FLAGS) + WAT2WASM=$(WAT2WASM) venv/bin/pytest tests $(TEST_FLAGS) lint: venv/.done venv/bin/pylint py2wasm diff --git a/tests/integration/helpers.py b/tests/integration/helpers.py index 444e1c0..e434d05 100644 --- a/tests/integration/helpers.py +++ b/tests/integration/helpers.py @@ -1,6 +1,8 @@ import io +import os import subprocess import sys + from tempfile import NamedTemporaryFile from pywasm import binary @@ -9,14 +11,16 @@ from pywasm import Runtime from py2wasm.utils import process def wat2wasm(code_wat): + path = os.environ.get('WAT2WASM', 'wat2wasm') + with NamedTemporaryFile('w+t') as input_fp: input_fp.write(code_wat) input_fp.flush() with NamedTemporaryFile('w+b') as output_fp: - result = subprocess.run( + subprocess.run( [ - 'wat2wasm', + path, input_fp.name, '-o', output_fp.name,