Skip to content

Commit f7ab4fd

Browse files
some unittest fixes
1 parent 5943631 commit f7ab4fd

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

course/page/code_run_backend_octave.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,12 @@ def output_html(s):
201201
if getattr(run_req, "setup_code", None):
202202
try:
203203
oc.eval(run_req.setup_code)
204+
# put variables from user in main context
205+
for name in run_req.names_for_user:
206+
try:
207+
maint_ctx[name] = oc.pull(name)
208+
except oct2py.Oct2PyError:
209+
maint_ctx[name] = None
204210
except Exception:
205211
package_exception(result, "setup_error")
206212
return

tests/test_pages/markdowns.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@
469469
# Adding two numbers in Octave
470470
471471
setup_code: |
472+
pkg load statistics
472473
a = unifrnd(-10,10)
473474
b = unifrnd(-10,10)
474475
@@ -507,6 +508,7 @@
507508
# Adding two numbers in Octave
508509
509510
setup_code: |
511+
pkg load statistics
510512
a = unifrnd(-10,10)
511513
b = unifrnd(-10,10)
512514
@@ -544,6 +546,7 @@
544546
# Adding two numbers in Octave
545547
546548
setup_code: |
549+
pkg load statistics
547550
a = unifrnd(-10,10)
548551
b = unifrnd(-10,10)
549552
@@ -581,6 +584,7 @@
581584
# Adding two numbers in Octave
582585
583586
setup_code: |
587+
pkg load statistics
584588
a = unifrnd(-10,10)
585589
b = unifrnd(-10,10)
586590
@@ -616,6 +620,7 @@
616620
# Adding two numbers in Octave
617621
618622
setup_code: |
623+
pkg load statistics
619624
a = unifrnd(-10,10)
620625
b = unifrnd(-10,10)
621626
@@ -650,6 +655,7 @@
650655
# Adding two numbers in Octave
651656
652657
setup_code: |
658+
pkg load statistics
653659
a = unifrnd(-10,10)
654660
b = unifrnd(-10,10)
655661
@@ -672,6 +678,7 @@
672678
# Adding two numbers in Octave
673679
674680
setup_code: |
681+
pkg load statistics
675682
a = unifrnd(-10,10)
676683
b = unifrnd(-10,10)
677684
@@ -703,6 +710,7 @@
703710
# Adding two numbers in Octave
704711
705712
setup_code: |
713+
pkg load statistics
706714
a = unifrnd(-10,10)
707715
b = unifrnd(-10,10)
708716
@@ -737,6 +745,7 @@
737745
# Adding two numbers in Octave
738746
739747
setup_code: |
748+
pkg load statistics
740749
a = unifrnd(-10,10)
741750
b = unifrnd(-10,10)
742751

0 commit comments

Comments
 (0)