JMU-CS / JMU-CS/jmu_python_gradescope_utils

Add submission metadata to assertRequiredFilesPresent

Offen
#10 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
2
Forks
0
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
testing-qa
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.