Commit 3b0dc503 authored by Boxiang Sun's avatar Boxiang Sun

Basic test fixing

The python which slapos used to run runTestSuite and the python which
installed by SlapOS is not identical...
parent 8c09dbe0
import subprocess
import importlib
import json
import build_extension
def run(env, python_path):
# Build the extension when installing the Cython in slapos
# subprocess.call([python_path, 'nogil_extension.py', 'build_ext', '--inplace'], env=env)
source = ''
source = subprocess.check_output([python_path + " -c 'import nogil_extension; a = nogil_extension.bag(); print(a)'"],
env=env,
shell=True,
)
failure_count = 0
try:
nogil_extension = importlib.import_module('nogil_extension')
except ImportError as e:
source = str(e)
failure_count = 1
else:
source = nogil_extension.bag()
if source != '4.0\n42.0':
failure_count = 1
if source != b'4.0\n42.0\n':
failure_count = 1
result_dict = {'failed':failure_count, 'stdout':source}
result_dict = {'failed': failure_count, 'stdout': source}
return result_dict
# print(json.dumps(result_dict))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment