Skip to content

Commit

Permalink
extra tests
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorcampbell committed Aug 31, 2023
1 parent bf37442 commit dd136fe
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions nbgrader/tests/preprocessors/test_instantiatetests.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,26 +89,28 @@ def test_consistent_release_version(self, preprocessor):
assert nb1['cells'][1]['source'] == nb2['cells'][1]['source']

# test that autotest starts a kernel that uses the `path` metadata as working directory
def test_kernel_workingdir(self, preprocessor, caplog):
# with the right path, the kernel should load the file
def test_kernel_right_workingdir(self, preprocessor, caplog):
sol_cell = create_autotest_solution_cell()
test_cell = create_autotest_test_cell()
load_cell = create_file_loader_cell('grades.csv')
test_cell.metadata['nbgrader'] = {'grade': True}

## with the right path, the kernel should load the file
#nb = new_notebook()
#nb.metadata['kernelspec'] = {
# "name": "python3"
#}
#nb.cells.append(sol_cell)
#nb.cells.append(test_cell)
#nb.cells.append(load_cell)
#resources = {
# 'metadata': {'path': 'nbgrader/docs/source/user_guide/'}
#}
#nb, resources = preprocessor.preprocess(nb, resources)
nb = new_notebook()
nb.metadata['kernelspec'] = {
"name": "python3"
}
nb.cells.append(sol_cell)
nb.cells.append(test_cell)
nb.cells.append(load_cell)
resources = {
'metadata': {'path': 'nbgrader/docs/source/user_guide/'}
}
nb, resources = preprocessor.preprocess(nb, resources)

# without the right path, the kernel should report an error
# test that autotest starts a kernel that uses the `path` metadata as working directory
# without the right path, the kernel should report an error
def test_kernel_wrong_workingdir(self, preprocessor, caplog):
nb = new_notebook()
nb.metadata['kernelspec'] = {
"name": "python3"
Expand Down

0 comments on commit dd136fe

Please sign in to comment.