8
8
python -m RLTest --test tests_llapi.py --module path/to/redisai.so
9
9
'''
10
10
11
-
12
- def ensure_test_module_loaded (f ):
11
+ def with_test_module (f ):
13
12
@wraps (f )
14
13
def wrapper (env , * args , ** kwargs ):
15
- goal_dir = os .path .join (os .path .dirname (__file__ ), "../module/LLAPI.so" )
16
- TEST_MODULE_PATH = os .path .abspath (goal_dir )
17
14
con = env .getConnection ()
18
15
modules = con .execute_command ("MODULE" , "LIST" )
19
16
if b'RAI_llapi' in [module [1 ] for module in modules ]:
20
17
return f (env , * args , ** kwargs )
21
18
try :
22
- ret = con .execute_command ('MODULE' , 'LOAD' , TEST_MODULE_PATH )
19
+ ret = con .execute_command ('MODULE' , 'LOAD' , TESTMOD_PATH )
23
20
env .assertEqual (ret , b'OK' )
24
21
except Exception as e :
25
22
env .assertFalse (True )
@@ -29,15 +26,15 @@ def wrapper(env, *args, **kwargs):
29
26
return wrapper
30
27
31
28
32
- @ensure_test_module_loaded
29
+ @with_test_module
33
30
def test_basic_check (env ):
34
31
35
32
con = env .getConnection ()
36
33
ret = con .execute_command ("RAI_llapi.basic_check" )
37
34
env .assertEqual (ret , b'OK' )
38
35
39
36
40
- @ensure_test_module_loaded
37
+ @with_test_module
41
38
def test_model_run_async (env ):
42
39
43
40
con = env .getConnection ()
@@ -56,7 +53,7 @@ def test_model_run_async(env):
56
53
env .assertEqual (ret , b'Async run success' )
57
54
58
55
59
- @ensure_test_module_loaded
56
+ @with_test_module
60
57
def test_script_run_async (env ):
61
58
62
59
con = env .getConnection ()
@@ -78,7 +75,7 @@ def test_script_run_async(env):
78
75
env .assertEqual (ret , b'Async run success' )
79
76
80
77
81
- @ensure_test_module_loaded
78
+ @with_test_module
82
79
def test_dag_build_and_run (env ):
83
80
con = env .getConnection ()
84
81
@@ -105,7 +102,7 @@ def test_dag_build_and_run(env):
105
102
env .assertEqual (ret , b'DAG run success' )
106
103
107
104
108
- @ensure_test_module_loaded
105
+ @with_test_module
109
106
def test_dagrun_multidevice_resnet (env ):
110
107
con = env .getConnection ()
111
108
0 commit comments