Don't mask setup errors

`_post_teardown()` always happens, and sometimes the `app` and/or `_ctx` attributes don't exist anymore. This triggers an `AttributeError` exception, which masks whatever the original exception was. Using `getattr()` allows the `AttributeError` to be avoided.
Make teardown more gracefull.

Add tests for unexpected modification of TestCase.app attribute.
Garbage collection after test is now optional
Refactor template renderer monkeypatching
Merge branch 'master' into graceful-teardown