Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent intercell seeding code from being added to cells using cell magic #758

Merged
merged 3 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
**v5.3.0 (unreleased):**

* Updated Otter Assign to throw a `ValueError` when invalid Python code is encountered in test cells per [#756](https://github.com/ucbds-infra/otter-grader/issues/756)
* Fixed an error causing intercell seeding code to be added to cells using cell magic commands which caused syntax errors per [#754](https://github.com/ucbds-infra/otter-grader/issues/754)

**v5.2.2:**

Expand Down
2 changes: 1 addition & 1 deletion otter/execute/preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@

cells = nb.cells[1:] if skip_first else nb.cells
for cell in cells:
if cell.cell_type == "code":
if cell.cell_type == "code" and not cell.source.startswith("%%"):

Check warning on line 125 in otter/execute/preprocessor.py

View check run for this annotation

Codecov / codecov/patch

otter/execute/preprocessor.py#L125

Added line #L125 was not covered by tests
cell.source = f"{do_seed}\n{cell.source}"

def add_checks(self, nb):
Expand Down
Loading