-
Notifications
You must be signed in to change notification settings - Fork 12
Tutorial Format
Sean Purdon edited this page Jan 29, 2015
·
2 revisions
The .tut format is a simple directory-based format.
A valid .tut directory must contain the following files:
example.tut/
-
analysis.py
- contains static analysis code
- must define
ANALYSER
to contain aCodeAnalyser
subclass-
CodeAnalyser
will be injected into the namespace when run
-
-
config.py
- defines configuration information for the tutorial
-
SHORT_DESCRIPTION
: a one-line explanation of the task, shown prominently on the UI -
WRAP_STUDENT_CODE
:True
if the student is not writing a function; can be omitted otherwise -
HINTS
: a list of hints (as strings) -
TIMEOUT
: the maximum time to permit to run all tests and perform static analysis on the tutorial (optional)
-
description.html
- the tutorial task description
-
preload.py
- the code which should be loaded into the MyPyTutor editor window when the tutorial is first run (or is reset)
-
support.py
- any code in this file will be executed before testing the student's submission
- use to define any required functions/classes
-
tests.py
- test cases for the student submission
- must define
TEST_CLASSES
as a list of test case classes (not instances) - each test case must inherit from
StudentTestCase
-
StudentTestCase
will be injected into the namespace when run - test cases must define two class variables:
-
DESCRIPTION
: a description of the test case, as a string, eg:add(1, 2) -> 3
orDoes not modify input
-
MAIN_TEST
: the name of the method corresponding to the description
-
- test cases must contain at least one test method
- output from this main test method will be shown to the student
- additional methods may be added to prevent students simply writing code which retursn the right values to meet the visible tests
- student code may be executed by calling
self.run_student_code
-
input_text
may be used to prove a string as stdin -
*args
and**kwargs
will be passed directly to the student's function
-
-
For a further explanation of how to add tutorial problems, see #15.