Django

To create a new assignment in Django, click into one of your courses, and then click Add assignment. Choose Django from the drop-down list of available full-stack languages and set the the rest of your assignment's parameters (deadline, etc.). Once the assignment is created, a new folder will be created in the private GitHub/GitLab template repository for the course in which you are added this assignment. This folder will contain a standard Django project structure.

Automated test-suite setup

If you would like to add tests that are automatically run by AssignmentOS against each student's solution to your assignment, you can add these as unit test files.

All unit test filenames must begin with test_ and all unit test files with names beginning with test_hidden_ will not be visible to the student.

If you want to add files that your hidden unit tests use and hence are also not visible to the student, the names of these files must begin with hidden, e.g., hiddenFoo.json, hiddenFoo.csv, hidden_foo.py, etc.

All unit tests must use the pytest unit test framework, version 6.0.0.

Any dependencies required for your assignment need to be included in the requirements.txt file and must be available to download using the pip package installer.

The Python code must be compatible with Python version 3.8.

GitHub Action & GitLab CI/CD

AssignmentOS uses either GitHub Actions or GitLab CI/CD (depending on whether you use with GitHub or GitLab) to run automated unit tests. We provide the following GitHub Action & GitLab CI/CD file for Django assignments. Note that this file is added dynamically to the repo of each student taking your assignment, so please do not include it in your template repo. This file also cannot be changed.

GitHub Action .yml file
GitLab CI/CD .yml file
name: Python CI

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3
    - name: Set up Python
      uses: actions/setup-python@v3
      with:
        python-version: '3.8'
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements.txt
    - name: Run tests
      run: pytest

Coming soon!

Examples

An example Python assignment that uses pytest for automated test suite scoring can be seen here: https://github.com/AssignmentOS-HQ/Python-AssignmentOS-Fibonacci

Last updated