Skip to content

Add submission metadata to assertRequiredFilesPresent #10

@ChrisMayfield

Description

@ChrisMayfield

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions