def stopTest(self, test):
     super().stopTest(test)
     new_cwd = safe_getcwd()
     if self.old_cwd is None or new_cwd is None \
        or self.old_cwd != new_cwd:
         raise RuntimeError("working directory changed during test")
 def startTest(self, test):
     self.old_cwd = safe_getcwd()
     super().startTest(test)