Martin Di Paola <martinp.dipa...@gmail.com> writes: > This may not answer your question but it may provide an alternative > solution. > > I had the same challenge that you an year ago so may be my solution will > work for you too. > > Imagine that you have a Markdown file that *documents* the expected > results. > > This is the final exam, good luck! > > First I'm going to load your code (the student's code): > > ```python >>>> import student > ``` > > Let's see if you programmed correctly a sort algorithm > > ```python >>>> data = [3, 2, 1, 3, 1, 9] >>>> student.sort_numbers(data) > [1, 1, 2, 3, 3, 9] > ``` > > Let's now if you can choose the correct answer: > > ```python >>>> t = ["foo", "bar", "baz"] >>>> student.question1(t) > "baz" > ``` > > Now you can run the snippets of code with: > > byexample -l python the_markdown_file.md > > What byexample does is to run the Python code, capture the output and > compare it with the expected result. > > In the above example "student.sort_numbers" must return the list > sorted. > That output is compared by byexample with the list written below. > > Advantages? Each byexample run is independent of the other and the > snippet of codes are executed in a separated Python process. byexample > takes care of the IPC. > > I don't know the details of your questions so I'm not sure if byexample > will be the tool for you. In my case I evaluate my students giving them > the Markdown and asking them to code the functions so they return the > expected values.
Currently procedures in one question are used in another question. Nevertheless, perhaps I could (in other tests) design something different. Although, to be honest, I would rather not have to use something like Markdown because that means more syntax for students. > Depending of how many students you have you may considere to > complement this with INGInious. It is designed to run students' > assignments assuming nothing on the untrusted code. > > Links: > > https://byexamples.github.io/byexample/ > https://docs.inginious.org/en/v0.7/ INGInious looks pretty interesting. Thank you! -- https://mail.python.org/mailman/listinfo/python-list