Skip to content

Commit 1a6613f

Browse files
author
Elias Werner
committed
add check for env variables in test
1 parent 7a2da1f commit 1a6613f

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

tests/kernel/writemode.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
- "%%start_writefile"
33
- - |
44
Started converting to Python script. See files:
5-
/home/runner/work/scorep_jupyter_kernel_python/jupyter_to_script_run.sh
6-
/home/runner/work/scorep_jupyter_kernel_python/jupyter_to_script.py
5+
${PWD}/jupyter_to_script_run.sh
6+
${PWD}/jupyter_to_script.py
77
-
88
- |-
99
%env SCOREP_ENABLE_TRACING=1
@@ -18,8 +18,8 @@
1818
- "%%start_writefile test_kernel_tmp/my_jupyter_to_script"
1919
- - |
2020
Started converting to Python script. See files:
21-
/home/runner/work/scorep_jupyter_kernel_python/test_kernel_tmp/my_jupyter_to_script_run.sh
22-
/home/runner/work/scorep_jupyter_kernel_python/test_kernel_tmp/my_jupyter_to_script.py
21+
${PWD}/test_kernel_tmp/my_jupyter_to_script_run.sh
22+
${PWD}/test_kernel_tmp/my_jupyter_to_script.py
2323
-
2424
- |-
2525
%env SCOREP_ENABLE_TRACING=1

tests/test_kernel.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import unittest
22
import jupyter_kernel_test as jkt
3-
import os
4-
import yaml
3+
import yaml, re, os
4+
55

66
tmp_dir = "test_kernel_tmp/"
77

@@ -28,6 +28,8 @@ def check_stream_output(self, code, expected_output, stream="stdout"):
2828
self.flush_channels()
2929
reply, output_msgs = self.execute_helper(code=code)
3030
for msg, expected_msg in zip(output_msgs, expected_output):
31+
# replace env vars
32+
expected_msg = os.path.expandvars(expected_msg)
3133
# self.assertEqual(msg["header"]["msg_type"], "stream")
3234
# some messages can be of type 'execute_result'
3335
# type instead of stdout
@@ -41,8 +43,10 @@ def check_stream_output(self, code, expected_output, stream="stdout"):
4143
)
4244

4345
def check_from_file(self, filename):
46+
4447
with open(filename, "r") as file:
4548
cells = yaml.safe_load(file)
49+
4650
for code, expected_output in cells:
4751
self.check_stream_output(code, expected_output)
4852

0 commit comments

Comments
 (0)