gradescope / gradescope-utils

Python package for building Gradescope autograders
https://gradescope-utils.readthedocs.io/en/latest/
MIT License
34 stars 25 forks source link

Enable Gradescope and Django Integration #35

Closed AndrewQuijano closed 1 year ago

AndrewQuijano commented 1 year ago

Hello, This code would allow for Gradescope to auto-grade assignments in a Django environment. Within my class, students are expected to repair a buggy Django implementation, and I have grading scripts to verify the bugs are remediated. However, to enable an integration with Gradescope, I had to tweak the default Django DiscoverRunner class to be able to output the JSON file required by Gradescope. The README is updated, describing the steps to complete the integration.

AndrewQuijano commented 1 year ago

Hello, Thank you for the quick response! I applied all the requested changes! Please let me know when the pull request would be completed. When might this be deployed, so I could use this on Gradescope?

AndrewQuijano commented 1 year ago

I guess this may be something to resolve for later. But, I am unsure if there is an easy way to edit the arguments for creating the JSONTestRunner here. Except from editing the files that are stored wherever standard library python code is.

ibrahima commented 1 year ago

That's a good question actually, I think that the right thing to do might be to pass in **kwargs here instead of listing them explicitly.

    def run_suite(self, suite, **kwargs):
        return JSONTestRunner(**kwargs).run(suite)

any default settings will already be active so there's no need to repeat them here.

To be honest, this also doesn't need to be done as part of gradescope-utils. If you just keep this class as part of your autograder code then you can pass whatever you want to the JSONTestRunner. In that scenario you wouldn't need to wait for this to be merged and released to use it. But I think it's nice to have this example for others who might be interested in running Django tests.

Edit: Though hmm, if you're just doing this, I don't know how you would pass arguments to the class:

TEST_RUNNER = 'gradescope_utils.autograder_utils.gradescope_django_runner.GradescopeDjangoRunner'

I don't know if there's another way to use a custom test runner in Django though? Hopefully there's a way where you can pass arguments to the test runner.

github-advanced-security[bot] commented 1 year ago

You have successfully added a new CodeQL configuration .github/workflows/codeql-analysis.yml:CodeQL-Build. As part of the setup process, we have scanned this repository and found no existing alerts. In the future, you will see all code scanning alerts on the repository Security tab.