JMU-CS / JMU-CS/jmu_python_gradescope_utils

Add submission metadata to assertRequiredFilesPresent

Aperta
#10 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
2
Fork
0
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
testing-qa
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.