Skip to content

Commit

Permalink
store kernel name in resources
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorcampbell committed Aug 23, 2023
1 parent 622aafa commit 84fd66b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions nbgrader/preprocessors/instantiatetests.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def preprocess(self, nb, resources):
if kernel_name not in self.sanitizers:
raise ValueError(f"Kernel {kernel_name} has not been specified in InstantiateTests.sanitizers")
self.log.debug(f"Found kernel {kernel_name}")
self.kernel_name = kernel_name
resources["kernel_name"] = kernel_name

# load the template tests file
self.log.debug('Loading template tests file')
Expand Down Expand Up @@ -156,7 +156,7 @@ def preprocess_cell(self, cell, resources, index):
is_grade_flag = utils.is_grade(cell)

# get the comment string for this language
comment_str = self.comment_strs[self.kernel_name]
comment_str = self.comment_strs[resources["kernel_name"]]

# split the code lines into separate strings
lines = cell.source.split("\n")
Expand Down Expand Up @@ -283,7 +283,7 @@ def _load_test_template_file(self, resources):
or perhaps cannot be loaded, it will attempt to load the default_tests.yaml file with the course_directory
"""
self.log.debug('loading template tests.yml...')
self.log.debug(f'kernel_name: {self.kernel_name}')
self.log.debug(f'kernel_name: {resources["kernel_name"]}')
try:
with open(os.path.join(resources['metadata']['path'], self.autotest_filename), 'r') as tests_file:
tests = yaml.safe_load(tests_file)
Expand Down Expand Up @@ -313,7 +313,7 @@ def _load_test_template_file(self, resources):
raise

# get kernel specific data
tests = tests[self.kernel_name]
tests = tests[resources["kernel_name"]]

# get the test templates
self.test_templates_by_type = tests['templates']
Expand Down

0 comments on commit 84fd66b

Please sign in to comment.