'Save C{sys.path} and C{sys.modules}, and create a package for tests.'

def setUp(self):

    self.originalPath = sys.path[:]
    self.savedModules = sys.modules.copy()
    self.root = FilePath(self.mktemp())
    self.root.createDirectory()
    self.package = self.root.child('mypackage')
    self.package.createDirectory()
    self.package.child('__init__.py').setContent('')
    FilePath(__file__).sibling('plugin_basic.py').copyTo(self.package.child('testplugin.py'))
    self.originalPlugin = 'testplugin'
    sys.path.insert(0, self.root.path)
    import mypackage
    self.module = mypackage
