macobo / python-grader

Python >= 3.3 automatic grader
MIT License
11 stars 5 forks source link

Two ways to test one function serveral times #9

Closed aivarannamaa closed 10 years ago

aivarannamaa commented 11 years ago

Sometimes we may want to test one function with different inputs without resetting the environment. This would catch the bugs where student's function works correctly only at first call. Is this possible at the moment?

Other times, we may want to execute separate tests in separate processes.

macobo commented 11 years ago

It is, you "only" have to write your own test wrapper (https://github.com/macobo/python-grader/blob/master/grader/test_wrappers.py) around it. I'll try document the process of writing tests (and wrappers) soon, but perhaps this will help you get started. You could also change the existing check_function wrapper, adding an optional parameter runs?

Other times, we may want to execute separate tests in separate processes.

If the global environment for the users program is reset, it shouldn't make a difference since the user program cannot see who is "importing" or executing it.

macobo commented 10 years ago

As said above, the correct thing to do would be to write your own wrapper.