Skip to content

Commit

Permalink
hash optional; raise error if not set
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorcampbell committed Aug 29, 2023
1 parent ec63545 commit e8c3d7e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nbgrader/preprocessors/instantiatetests.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ def preprocess_cell(self, cell, resources, index):
# appears in the line before the self.autotest_delimiter token
use_hash = (self.hashed_delimiter in line[:line.find(self.autotest_delimiter)])
if use_hash:
if self.hash_template is None:
raise ValueError('Found a hashing delimiter, but the hash property has not been set in autotests.yml')
self.log.debug('Hashing delimiter found, using template: %s', self.hash_template)
else:
self.log.debug('Hashing delimiter not found')
Expand Down Expand Up @@ -323,7 +325,7 @@ def _load_test_template_file(self, resources):
self.success_code = tests.get('success', None)

# get the hash code template
self.hash_template = tests['hash']
self.hash_template = tests.get('hash', None)

# get the hash code template
self.check_template = tests['check']
Expand Down

0 comments on commit e8c3d7e

Please sign in to comment.