diff --git a/CHANGELOG.md b/CHANGELOG.md index 901dd0a6..8b8d64d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * Wrap `ModuleNotFoundError` for `otter` in grading image to include debugging instructions per [#907](https://github.com/ucbds-infra/otter-grader/issues/907) * Updated Otter Assign to disallow metadata tests for Colab notebooks per [#901](https://github.com/ucbds-infra/otter-grader/issues/901) * Updated Otter Assign to leave solution cell tags in student notebooks per [#893](https://github.com/ucbds-infra/otter-grader/issues/893) +* Updated `Notebook.export` zip validation to emit a `RuntimeWarning` instead of a `RuntimeError` when anything is written to stderr per [#915](https://github.com/ucbds-infra/otter-grader/issues/915) **v6.0.5:** diff --git a/otter/check/utils.py b/otter/check/utils.py index da6d59a6..53f16a91 100644 --- a/otter/check/utils.py +++ b/otter/check/utils.py @@ -6,6 +6,7 @@ import sys import tempfile import time +import warnings import wrapt from dataclasses import dataclass @@ -111,7 +112,7 @@ def grade_zip_file(zip_path: str, nb_arcname: str, tests_dir: str) -> GradingRes print(results.stdout.decode("utf-8")) if results.stderr: - raise RuntimeError(results.stderr.decode("utf-8")) + warnings.warn(results.stderr.decode("utf-8"), RuntimeWarning) with open(results_path, "rb") as f: results = dill.load(f) diff --git a/otter/check/validate_export/__main__.py b/otter/check/validate_export/__main__.py index eb9616ea..338807ca 100644 --- a/otter/check/validate_export/__main__.py +++ b/otter/check/validate_export/__main__.py @@ -1,12 +1,13 @@ """A Python module for validating that a submission zip file passes test cases""" -# suppress all warnings, because otherwise they get printed to stderr which triggers a RuntimeError -# in the calling code -- see #735 import warnings +# suppress all warnings, because otherwise they get printed to stderr which triggers a RuntimeError +# in the calling code -- see #735 warnings.simplefilter("ignore") + import argparse import dill import os @@ -28,11 +29,7 @@ def get_parser(): return parser -warnings.warn("foo", RuntimeWarning) - - def main(): - args = get_parser().parse_args() nb_dir = tempfile.mkdtemp()