Skip to content

Commit 9dd7561

Browse files
committed
Set RedisGears path for redis gears tests
1 parent e1b7a7e commit 9dd7561

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

tests/flow/includes.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@
1010
from skimage.io import imread
1111
from skimage.transform import resize
1212

13-
try:
14-
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../../deps/readies"))
15-
import paella
16-
except:
17-
pass
1813

14+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../../opt/readies"))
15+
import paella
16+
17+
ROOT = os.environ.get("ROOT")
1918
MAX_ITERATIONS = 2 if os.environ.get("MAX_ITERATIONS") == None else os.environ.get("MAX_ITERATIONS")
2019
TEST_TF = os.environ.get("TEST_TF") != "0" and os.environ.get("WITH_TF") != "0"
2120
TEST_TFLITE = os.environ.get("TEST_TFLITE") != "0" and os.environ.get("WITH_TFLITE") != "0"

tests/flow/tests_withGears.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ def wrapper(env, *args, **kwargs):
1313
if b'rg' in [module[1] for module in modules]:
1414
return f(env, *args, **kwargs)
1515
try:
16-
redisgears_path = os.path.join(os.path.dirname(__file__), 'bin/RedisGears/redisgears.so')
17-
python_plugin_path = os.path.join(os.path.dirname(__file__), 'bin/RedisGears/plugin/gears_python.so')
18-
python_env_path = os.path.join(os.path.dirname(__file__), 'bin/RedisGears')
16+
platform = paella.Platform()
17+
redisgears_dir = "{ROOT}/bin/{PLATFORM}/RedisGears".format(ROOT=ROOT, PLATFORM=platform.triplet())
18+
redisgears_path = os.path.join(redisgears_dir, 'redisgears.so')
19+
python_plugin_path = os.path.join(redisgears_dir, 'plugin/gears_python.so')
1920
ret = con.execute_command('MODULE', 'LOAD', redisgears_path, 'Plugin', python_plugin_path, 'CreateVenv',
20-
0, 'PythonInstallationDir', python_env_path)
21+
0, 'PythonInstallationDir', redisgears_dir)
2122
env.assertEqual(ret, b'OK')
2223
except Exception as e:
2324
env.debugPrint(str(e), force=True)
@@ -44,7 +45,7 @@ def ping(record):
4445

4546

4647
@skip_if_gears_not_loaded
47-
def ntest_model_run(env):
48+
def test_model_run(env):
4849
script = '''
4950
5051
import redisAI
@@ -119,7 +120,7 @@ async def ModelRun_AsyncRunError(record):
119120

120121

121122
@skip_if_gears_not_loaded
122-
def ntest_script_run(env):
123+
def test_script_run(env):
123124
script = '''
124125
125126
import redisAI
@@ -198,7 +199,7 @@ async def ScriptRun_AsyncRunError(record):
198199

199200

200201
@skip_if_gears_not_loaded
201-
def ntest_DAG_run_via_gears(env):
202+
def test_DAG_run_via_gears(env):
202203
script = '''
203204
204205
import redisAI
@@ -322,3 +323,4 @@ async def DAGRun_addOpsFromString(record):
322323

323324
values = con.execute_command('AI.TENSORGET', 'test5_res{1}', 'VALUES')
324325
env.assertEqual(values, [b'4', b'9', b'4', b'9'])
326+

0 commit comments

Comments
 (0)