macobo / python-grader

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

Override __name__ to be __main__ in tested user module #18

Closed macobo closed 10 years ago

macobo commented 11 years ago

It's quite common (even idiomatic) to write code similar to the following.

# declare classes, functions
if __name__ == "__main__":
     # call those functions

However, this doesn't work at the moment, since __name__ will be set to something else.