Skip to content

Runestone Issue: CodeTailor 500 error when activecode exercise has no unit tests #1211

@aspadiyath

Description

@aspadiyath

What Page were you on
Testing a CodeTailor problem in assignment builder

Describe the bug
When a CodeTailor-enabled activecode exercise has no suffix/unit-test code, clicking "Get Help" returns a 500 Internal Server Error.

Root cause: end_to_end.py:32 unconditionally calls .replace() on Unittest_Code from the request payload:

unittest_code = dict_buggy_code["Unittest_Code"].replace("\n", "\n")

When the exercise has no suffix code, the JS cleanTestcase() function returns undefined, so Unittest_Code arrives as None in Python, causing AttributeError: 'NoneType' object has no attribute 'replace'. The same issue affects CF (Code) on lines 28 if that is ever empty.

Javascript Errors

500 (Internal Server Error)
Error or timeout waiting for Parsons scaffolding response Error: HTTP 500 - {"detail":"'NoneType' object has no attribute 'replace'"}
Uncaught (in promise) Error in Parsons Scaffolding: Error: HTTP 500 - {"detail":"'NoneType' object has no attribute 'replace'"}

Potential fixes
If CodeTailor is enabled, suffix code is required? Or if no suffix code, CodeTailor does not run and shows its error message without a 500 error?

What is your username
apadiyath

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions