Skip to content

Commit 23a6975

Browse files
committed
another test
1 parent 8728355 commit 23a6975

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from cube import TemplateContext
2+
import sys
3+
import os
4+
5+
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
6+
7+
from utils import answer_to_main_question
8+
9+
template = TemplateContext()
10+
11+
value_or_none = os.getenv('MY_ENV_VAR')
12+
template.add_variable('value_or_none', value_or_none)
13+
14+
value_or_default = os.getenv('MY_OTHER_ENV_VAR', 'my_default_value')
15+
template.add_variable('value_or_default', value_or_default)
16+
17+
template.add_variable('answer_to_main_question', answer_to_main_question())

packages/cubejs-backend-native/test/python.test.ts

+8
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ suite('Python Models', () => {
3838
// Just checking it won't fail
3939
await nativeInstance.loadPythonContext(fullFileName, content);
4040
});
41+
42+
test('models import with sys.path changed', async () => {
43+
const fullFileName = path.join(process.cwd(), 'test', 'globals_w_import_path.py');
44+
const content = await fs.readFile(fullFileName, 'utf8');
45+
46+
// Just checking it won't fail
47+
await nativeInstance.loadPythonContext(fullFileName, content);
48+
});
4149
});
4250

4351
suite('Python Config', () => {

0 commit comments

Comments
 (0)