Skip to content

Commit 4488c8a

Browse files
committed
Loading gears before test - PR fixes
1 parent c9eba52 commit 4488c8a

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

tests/flow/includes.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../../opt/readies"))
1515
import paella
1616

17-
ROOT = os.environ.get("ROOT")
17+
ROOT = os.environ.get("ROOT", None)
18+
if ROOT is None:
19+
sys.stderr.write("ROOT was not defined in the environment.\n")
20+
sys.exit(1)
1821
MAX_ITERATIONS = 2 if os.environ.get("MAX_ITERATIONS") == None else os.environ.get("MAX_ITERATIONS")
1922
TEST_TF = os.environ.get("TEST_TF") != "0" and os.environ.get("WITH_TF") != "0"
2023
TEST_TFLITE = os.environ.get("TEST_TFLITE") != "0" and os.environ.get("WITH_TFLITE") != "0"

tests/flow/tests_withGears.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,18 @@ def wrapper(env, *args, **kwargs):
1212
modules = con.execute_command("MODULE", "LIST")
1313
if b'rg' in [module[1] for module in modules]:
1414
return f(env, *args, **kwargs)
15+
platform = paella.Platform()
16+
redisgears_dir = "{ROOT}/bin/{PLATFORM}/RedisGears".format(ROOT=ROOT, PLATFORM=platform.triplet())
17+
if not os.path.isdir(redisgears_dir):
18+
env.debugPrint("RedisGears directory does not exist", force=True)
19+
return
20+
redisgears_path = os.path.join(redisgears_dir, 'redisgears.so')
21+
python_plugin_path = os.path.join(redisgears_dir, 'plugin/gears_python.so')
1522
try:
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')
2023
ret = con.execute_command('MODULE', 'LOAD', redisgears_path, 'Plugin', python_plugin_path, 'CreateVenv',
2124
0, 'PythonInstallationDir', redisgears_dir)
2225
env.assertEqual(ret, b'OK')
23-
except Exception as e:
24-
env.debugPrint(str(e), force=True)
26+
except Exception:
2527
env.debugPrint("skipping since RedisGears not loaded", force=True)
2628
return
2729
return f(env, *args, **kwargs)

0 commit comments

Comments
 (0)