Skip to content

Commit

Permalink
some unittest fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
karthiksharma98 committed Apr 21, 2021
1 parent 2b88d92 commit 2578b3b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions course/page/code_run_backend_octave.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ def output_html(s):
if getattr(run_req, "setup_code", None):
try:
oc.eval(run_req.setup_code)
# put variables from user in main context
for name in run_req.names_for_user:
try:
maint_ctx[name] = oc.pull(name)
except oct2py.Oct2PyError:
maint_ctx[name] = None
except Exception:
package_exception(result, "setup_error")
return
Expand Down
9 changes: 9 additions & 0 deletions tests/test_pages/markdowns.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@
# Adding two numbers in Octave
setup_code: |
pkg load statistics
a = unifrnd(-10,10)
b = unifrnd(-10,10)
Expand Down Expand Up @@ -507,6 +508,7 @@
# Adding two numbers in Octave
setup_code: |
pkg load statistics
a = unifrnd(-10,10)
b = unifrnd(-10,10)
Expand Down Expand Up @@ -544,6 +546,7 @@
# Adding two numbers in Octave
setup_code: |
pkg load statistics
a = unifrnd(-10,10)
b = unifrnd(-10,10)
Expand Down Expand Up @@ -581,6 +584,7 @@
# Adding two numbers in Octave
setup_code: |
pkg load statistics
a = unifrnd(-10,10)
b = unifrnd(-10,10)
Expand Down Expand Up @@ -616,6 +620,7 @@
# Adding two numbers in Octave
setup_code: |
pkg load statistics
a = unifrnd(-10,10)
b = unifrnd(-10,10)
Expand Down Expand Up @@ -650,6 +655,7 @@
# Adding two numbers in Octave
setup_code: |
pkg load statistics
a = unifrnd(-10,10)
b = unifrnd(-10,10)
Expand All @@ -672,6 +678,7 @@
# Adding two numbers in Octave
setup_code: |
pkg load statistics
a = unifrnd(-10,10)
b = unifrnd(-10,10)
Expand Down Expand Up @@ -703,6 +710,7 @@
# Adding two numbers in Octave
setup_code: |
pkg load statistics
a = unifrnd(-10,10)
b = unifrnd(-10,10)
Expand Down Expand Up @@ -737,6 +745,7 @@
# Adding two numbers in Octave
setup_code: |
pkg load statistics
a = unifrnd(-10,10)
b = unifrnd(-10,10)
Expand Down

0 comments on commit 2578b3b

Please sign in to comment.