def addFakePlugin(testCase, dropinSource='fakeendpoint.py'):
 import sys
 savedModules = sys.modules.copy()
 savedPluginPath = list(plugins.__path__)
 def cleanup():
  sys.modules.clear()
  sys.modules.update(savedModules)
  plugins.__path__[:] = savedPluginPath
 testCase.addCleanup(cleanup)
 fp = FilePath(testCase.mktemp())
 fp.createDirectory()
 getModule(__name__).filePath.sibling(dropinSource).copyTo(fp.child(dropinSource))
 plugins.__path__.append(fp.path)

def addFakePlugin ( testCase , dropinSource = 'fakeendpoint.py' ) : import sys savedModules = sys . modules . copy ( ) savedPluginPath = list ( plugins . __path__ ) def cleanup ( ) : sys . modules . clear ( ) sys . modules . update ( savedModules ) plugins . __path__ [ : ] = savedPluginPath testCase . addCleanup ( cleanup ) fp = FilePath ( testCase . mktemp ( ) ) fp . createDirectory ( ) getModule ( __name__ ) . filePath . sibling ( dropinSource ) . copyTo ( fp . child ( dropinSource ) ) plugins . __path__ . append ( fp . path )
for the duration of c{testcase} .