During the CS 149 planning meeting today, we had the idea to combine these two tests into one. The code in test_submission_count could be added to assertRequiredFilesPresent.
@weight(0)
def test_submission_count(self):
"""Submission count"""
try:
meta = json.load(open("/autograder/submission_metadata.json"))
except FileNotFoundError:
print("WARNING: metadata not found (please notify your instructor)")
return # This error should happen only when testing the autograder
count = 1 + len(meta["previous_submissions"])
stamp = datetime.fromisoformat(meta["created_at"])
stamp += timedelta(hours=3) # Pacific to Eastern
stamp = stamp.strftime("%b %d at %H:%M:%S")
print(f"Submission {count} ({stamp})")
@required()
@weight(0)
def test_submitted_files(self):
"""Check submitted files"""
self.assertRequiredFilesPresent([FILENAME])
In addition, assertRequiredFilesPresent could enforce a submission limit:
@required()
@weight(0)
def test_submission_count(self):
"""Submission count"""
try:
meta = json.load(open("/autograder/submission_metadata.json"))
except FileNotFoundError:
print("WARNING: metadata not found (please notify your instructor)")
return # This error should happen only when testing the autograder
count = 1 + len(meta["previous_submissions"])
print(f"Submission {count} of {MAX_SUBMISSIONS}")
if count > MAX_SUBMISSIONS:
self.fail("Limit exceeded. Please click the Submission History button "
"and activate the submission you would like us to grade.\n")
During the CS 149 planning meeting today, we had the idea to combine these two tests into one. The code in
test_submission_countcould be added toassertRequiredFilesPresent.In addition,
assertRequiredFilesPresentcould enforce a submission limit: