File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -207,9 +207,9 @@ def id_generator(size=6, chars=string.ascii_uppercase + string.digits):
207207 return '' .join (random .choice (chars ) for _ in range (size ))
208208
209209
210- def grade_notebook (notebook_path , tests_glob = None ):
210+ def run_nb_tests (notebook_path , tests_glob = None ):
211211 """
212- Grade a notebook file & return grade
212+ Run tests on a notebook and return score, test_results
213213 """
214214 try :
215215 # Lots of notebooks call grade_notebook in them. These notebooks are then
@@ -256,7 +256,14 @@ def grade_notebook(notebook_path, tests_glob=None):
256256
257257 # avoid divide by zero error if there are no tests
258258 score = sum ([r .grade for r in test_results ])/ max (len (test_results ), 1 )
259+ return score , test_results
259260
261+
262+ def grade_notebook (notebook_path , tests_glob = None ):
263+ """
264+ Grade a notebook file & return grade
265+ """
266+ score , test_results = run_nb_tests (notebook_path , tests_glob )
260267 # If within an IPython or Jupyter environment, display hints
261268 display_defined = False
262269 try :
You can’t perform that action at this time.
0 commit comments