def unsetEnvironment(self):
        """
        Change the Python environment back to what it was before the test was
        started.
        """
        invalidateImportCaches()
        sys.modules.clear()
        sys.modules.update(self.savedModules)
        sys.path[:] = self.savedPath

        Change the Python environment back to what it was before the test was
        started.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_plugin.py