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

Wrap ModuleNotFoundError for otter in run_otter.py #912

Merged
merged 2 commits into from
Jan 24, 2025
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 @@ -4,6 +4,7 @@

* Update Otter Assign to handle notebooks with an invalid kernelspec by assuming the language is Python per [#895](https://github.com/ucbds-infra/otter-grader/issues/895)
* Fixed assignment summary in Otter Assign so that manual questions are included per [#886](https://github.com/ucbds-infra/otter-grader/issues/886)
* Wrap `ModuleNotFoundError` for `otter` in grading image to include debugging instructions per [#907](https://github.com/ucbds-infra/otter-grader/issues/907)

**v6.0.5:**

Expand Down
11 changes: 10 additions & 1 deletion otter/generate/templates/common/run_otter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
"""Runs Otter-Grader's autograding process"""

from otter.run.run_autograder import main as run_autograder
try:
from otter.run.run_autograder import main as run_autograder
except ModuleNotFoundError as e:
if "'otter'" in str(e):
raise RuntimeError(
"The 'otter' module could not be imported. This is usually caused by errors while building the "
"grading image, so check the image build logs and include them when requesting "
"support."
)
raise e


if __name__ == "__main__":
Expand Down
11 changes: 10 additions & 1 deletion test/test_assign/files/example-autograder-correct/run_otter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
"""Runs Otter-Grader's autograding process"""

from otter.run.run_autograder import main as run_autograder
try:
from otter.run.run_autograder import main as run_autograder
except ModuleNotFoundError as e:
if "'otter'" in str(e):
raise RuntimeError(
"The 'otter' module could not be imported. This is usually caused by errors while building the "
"grading image, so check the image build logs and include them when requesting "
"support."
)
raise e


if __name__ == "__main__":
Expand Down
11 changes: 10 additions & 1 deletion test/test_assign/files/gs-autograder-correct/run_otter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
"""Runs Otter-Grader's autograding process"""

from otter.run.run_autograder import main as run_autograder
try:
from otter.run.run_autograder import main as run_autograder
except ModuleNotFoundError as e:
if "'otter'" in str(e):
raise RuntimeError(
"The 'otter' module could not be imported. This is usually caused by errors while building the "
"grading image, so check the image build logs and include them when requesting "
"support."
)
raise e


if __name__ == "__main__":
Expand Down
11 changes: 10 additions & 1 deletion test/test_assign/files/rmd-autograder-correct/run_otter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
"""Runs Otter-Grader's autograding process"""

from otter.run.run_autograder import main as run_autograder
try:
from otter.run.run_autograder import main as run_autograder
except ModuleNotFoundError as e:
if "'otter'" in str(e):
raise RuntimeError(
"The 'otter' module could not be imported. This is usually caused by errors while building the "
"grading image, so check the image build logs and include them when requesting "
"support."
)
raise e


if __name__ == "__main__":
Expand Down
11 changes: 10 additions & 1 deletion test/test_generate/files/autograder-correct/run_otter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
"""Runs Otter-Grader's autograding process"""

from otter.run.run_autograder import main as run_autograder
try:
from otter.run.run_autograder import main as run_autograder
except ModuleNotFoundError as e:
if "'otter'" in str(e):
raise RuntimeError(
"The 'otter' module could not be imported. This is usually caused by errors while building the "
"grading image, so check the image build logs and include them when requesting "
"support."
)
raise e


if __name__ == "__main__":
Expand Down
11 changes: 10 additions & 1 deletion test/test_generate/files/autograder-custom-env/run_otter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
"""Runs Otter-Grader's autograding process"""

from otter.run.run_autograder import main as run_autograder
try:
from otter.run.run_autograder import main as run_autograder
except ModuleNotFoundError as e:
if "'otter'" in str(e):
raise RuntimeError(
"The 'otter' module could not be imported. This is usually caused by errors while building the "
"grading image, so check the image build logs and include them when requesting "
"support."
)
raise e


if __name__ == "__main__":
Expand Down
11 changes: 10 additions & 1 deletion test/test_generate/files/autograder-r-correct/run_otter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
"""Runs Otter-Grader's autograding process"""

from otter.run.run_autograder import main as run_autograder
try:
from otter.run.run_autograder import main as run_autograder
except ModuleNotFoundError as e:
if "'otter'" in str(e):
raise RuntimeError(
"The 'otter' module could not be imported. This is usually caused by errors while building the "
"grading image, so check the image build logs and include them when requesting "
"support."
)
raise e


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
"""Runs Otter-Grader's autograding process"""

from otter.run.run_autograder import main as run_autograder
try:
from otter.run.run_autograder import main as run_autograder
except ModuleNotFoundError as e:
if "'otter'" in str(e):
raise RuntimeError(
"The 'otter' module could not be imported. This is usually caused by errors while building the "
"grading image, so check the image build logs and include them when requesting "
"support."
)
raise e


if __name__ == "__main__":
Expand Down
11 changes: 10 additions & 1 deletion test/test_generate/files/autograder-token-correct/run_otter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
"""Runs Otter-Grader's autograding process"""

from otter.run.run_autograder import main as run_autograder
try:
from otter.run.run_autograder import main as run_autograder
except ModuleNotFoundError as e:
if "'otter'" in str(e):
raise RuntimeError(
"The 'otter' module could not be imported. This is usually caused by errors while building the "
"grading image, so check the image build logs and include them when requesting "
"support."
)
raise e


if __name__ == "__main__":
Expand Down
11 changes: 10 additions & 1 deletion test/test_run/files/autograder/source/run_otter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
"""Runs Otter-Grader's autograding process"""

from otter.run.run_autograder import main as run_autograder
try:
from otter.run.run_autograder import main as run_autograder
except ModuleNotFoundError as e:
if "'otter'" in str(e):
raise RuntimeError(
"The 'otter' module could not be imported. This is usually caused by errors while building the "
"grading image, so check the image build logs and include them when requesting "
"support."
)
raise e


if __name__ == "__main__":
Expand Down
13 changes: 12 additions & 1 deletion test/test_run/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,18 @@

from otter.generate.token import APIClient
from otter.run import main as run_main
from otter.run.run_autograder import main as run_autograder


try:
from otter.run.run_autograder import main as run_autograder
except ModuleNotFoundError as e:
if "'otter'" in str(e):
raise RuntimeError(
"The 'otter' module could not be imported. This is usually caused by errors while building the "
"grading image, so check the image build logs and include them when requesting "
"support."
)
raise e
from otter.run.run_autograder.utils import OtterRuntimeError
from otter.test_files import GradingResults
from otter.utils import chdir, NBFORMAT_VERSION
Expand Down
Loading