JMU-CS / JMU-CS/jmu_python_gradescope_utils

Add submission metadata to assertRequiredFilesPresent

Open
#10 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2
Forks
0
PR merge metrics
No merged PRs in 30d

Description

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`.

``` py
@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:

``` py
@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")
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating assertRequiredFilesPresent and the two shown test methods, test_submission_count and test_submitted_files. Read how submission metadata and MAX_SUBMISSIONS are currently handled. Done means the required-file check reports submission metadata and the requested submission-limit behavior is covered by the relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.