Skip to content
Add Chan edited this page Dec 23, 2017 · 3 revisions

OK supports custom ok_tests as a source.

Configuration

There is one way to specify ok_tests as a source:

  • All ok_tests in file(s). For example:

      "tests/hw1.py": "ok_test"
    

    This specifies all ok_tests loaded from the file tests/hw1.py for hw1.py. All of the tests would be in a tests folder.

Format

The current format for configuration files is the following:

test = {
  'name': 'name of assignment',
  'points': ... // number of points
  'suites': [ // suites of test cases
    {
      'cases': [ // individual test cases; can list multiple separated by commas
        {
          'code': r""" // code to test and expect for
          scm> (caddr '(1 2 3 4))
          3
          """,
          'hidden': ... // visible to student
          'locked': ... // question is locked or unlocked
        }
      ],
      'scored': ... // whether student answered question correctly
      'setup': r""" // code needed to be executed to set up program
      scm> (load 'hw08)
      """,
      'teardown': 'code executed after test',
      'type': 'type of ok test'
    }
  ]
}

Developer Notes

The doctest source is mainly a wrapper on top of client.sources.common.doctest_case.DoctestCase.

Clone this wiki locally