Skip to content

Commit

Permalink
Update python to python3.12 for GS (#124)
Browse files Browse the repository at this point in the history
* Fix issues with gradescope python3 and add error message when no tests run

* fix tests

* Upgrade gradescope to python3.12
  • Loading branch information
gregbell26 authored Jan 4, 2025
1 parent 153493f commit 98046da
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
13 changes: 8 additions & 5 deletions source/autograder_cli/build_autograder.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,18 +165,21 @@ def createFolders(self):
def createSetupForGradescope(path: str, version: str):
with open(os.path.join(path, "setup.sh"), "w") as w:
w.write(
"apt-get install python3.11 -y\n"
"apt-get install python3-pip -y\n"
# "apt-get install -y libgbm-dev xvfb\n"
"pip3 install --upgrade pip\n"
f"pip3 install 128Autograder=={version}\n"
"add-apt-repository ppa:deadsnakes/ppa -y\n"
"apt update"
"apt-get install python3.12 -y\n"
"apt-get install python3.12-venv -y\n"
"python3.12 -m venv /autograder/.venv\n"
"source /autograder/.venv/bin/activate\n"
f"pip install 128Autograder=={version}\n"
)

@staticmethod
def createRunFileForGradescope(path: str):
with open(os.path.join(path, "run_autograder"), "w") as w:
w.write(
"#!/bin/bash\n"
"source /autograder/.venv/bin/activate\n"
"pushd source > /dev/null || echo 'Autograder failed to open source'\n"
"run_gradescope\n"
"popd > /dev/null || true\n"
Expand Down
4 changes: 4 additions & 0 deletions source/autograder_cli/run_gradescope.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ def gradescope_post_processing(self, autograderResults: Dict):
if not os.path.exists(self.arguments.metadata_path):
return

if "tests" not in autograderResults or len(autograderResults["tests"]) == 0:
autograderResults['output'] = "No tests were run. If you are a student seeing this message, please notify course staff."
return

# for now, we aren't implementing any new features for this
submissionLimit = self.config.config.submission_limit
takeHighest = self.config.config.take_highest
Expand Down
2 changes: 1 addition & 1 deletion source/autograder_platform/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "5.0.4"
__version__ = "5.0.5"
7 changes: 7 additions & 0 deletions tests/cli_tests/testRunGradescope.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ def setUp(self) -> None:
}

self.autograderResults = {
"tests": [
{
"name": 'This is a test',
"status": 'passed',
},

],
"score": 0
}
self.gradescopeCLI = GradescopeAutograderCLI()
Expand Down

0 comments on commit 98046da

Please sign in to comment.