File tree 3 files changed +29
-0
lines changed
packages/cubejs-backend-native/test
3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ from cube import TemplateContext
2
+ import os
3
+ from utils import answer_to_main_question
4
+
5
+
6
+ template = TemplateContext ()
7
+
8
+ value_or_none = os .getenv ('MY_ENV_VAR' )
9
+ template .add_variable ('value_or_none' , value_or_none )
10
+
11
+ value_or_default = os .getenv ('MY_OTHER_ENV_VAR' , 'my_default_value' )
12
+ template .add_variable ('value_or_default' , value_or_default )
13
+
14
+ template .add_variable ('answer_to_main_question' , answer_to_main_question ())
Original file line number Diff line number Diff line change @@ -28,6 +28,18 @@ async function loadConfigurationFile(fileName: string) {
28
28
return config ;
29
29
}
30
30
31
+ const nativeInstance = new native . NativeInstance ( ) ;
32
+
33
+ suite ( 'Python Models' , ( ) => {
34
+ test ( 'models import' , async ( ) => {
35
+ const fullFileName = path . join ( process . cwd ( ) , 'test' , 'globals.py' ) ;
36
+ const content = await fs . readFile ( fullFileName , 'utf8' ) ;
37
+
38
+ // Just checking it won't fail
39
+ await nativeInstance . loadPythonContext ( fullFileName , content ) ;
40
+ } ) ;
41
+ } ) ;
42
+
31
43
suite ( 'Python Config' , ( ) => {
32
44
let config : PyConfiguration ;
33
45
Original file line number Diff line number Diff line change 3
3
# Simple test function
4
4
def test_function (query : dict ) -> dict :
5
5
return query
6
+
7
+ def answer_to_main_question () -> str :
8
+ return "42"
You can’t perform that action at this time.
0 commit comments