Skip to content

Commit

Permalink
trying to provoke failure
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorcampbell committed Aug 31, 2023
1 parent 45ca48e commit 7d45d16
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions nbgrader/tests/preprocessors/test_instantiatetests.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,40 +87,40 @@ def test_consistent_release_version(self, preprocessor):
nb2, resources2 = preprocessor.preprocess(nb2, resources2)
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):
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}
## test that autotest starts a kernel that uses the `path` metadata as working directory
#def test_kernel_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)
# # 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)

# without the right path, the kernel should report an error
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/source/'}
}
with pytest.raises(Exception):
nb, resources = preprocessor.preprocess(nb, resources)
assert "FileNotFoundError" in caplog.text
# # without the right path, the kernel should report an error
# 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/source/'}
# }
# with pytest.raises(Exception):
# nb, resources = preprocessor.preprocess(nb, resources)
# assert "FileNotFoundError" in caplog.text

# test that a warning is thrown when we set enforce_metadata = False and have an AUTOTEST directive in a
# non-grade cell
Expand Down

0 comments on commit 7d45d16

Please sign in to comment.