clean temp dir in /tmp

In unit tests, many test class use tempfile.mkdtemp in SetUp and
shutil.rmtree in tearDown.

A common wrong case is putting test data in `testdir = os.join(mkdtemp() +
'some_class')` and `rmmtree(testdir)`. As a result, /tmp/xxx/some_class
was deleted, but /tmp/xxx is still leaved in system. So a proper fix is
`rmtree(os.path.dirname(testdir), ignore_errors=1)`

fixes bug #1212583

Change-Id: Iafbe3e11f16b51bdf49abce9e68eb01f25bc5df2
Merge "clean temp dir in /tmp"