File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed
packages/cubejs-backend-native/test Expand file tree Collapse file tree 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) {
2828 return config ;
2929}
3030
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+
3143suite ( 'Python Config' , ( ) => {
3244 let config : PyConfiguration ;
3345
Original file line number Diff line number Diff line change 33# Simple test function
44def test_function (query : dict ) -> dict :
55 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