'Clean up global state artifacts.
Some methods modify the global interpreter state and this
tries to clean this up.  It does not remove the temporary
directory however so it can be looked at after the test run
has finished.'

def finalize(self):

    (sys.path[:], sys.meta_path[:]) = self._savesyspath
    if hasattr(self, '_olddir'):
        self._olddir.chdir()
    self.delete_loaded_modules()
