'Add our example directory to the path and record which modules are
currently loaded.'

def setUp(self):

    self.originalPath = sys.path[:]
    self.originalModules = sys.modules.copy()
    self.fakeErr = NativeStringIO()
    self.patch(sys, 'stderr', self.fakeErr)
    self.fakeOut = NativeStringIO()
    self.patch(sys, 'stdout', self.fakeOut)
    here = FilePath(__file__).parent().parent().parent().parent().child('docs')
    for childName in self.exampleRelativePath.split('/'):
        here = here.child(childName)
        if (not here.exists()):
            raise SkipTest(('Examples    (%s)    not    found    -    cannot    test' % (here.path,)))
    self.examplePath = here
    sys.path.append(self.examplePath.parent().path)
    moduleName = self.examplePath.basename().split('.')[0]
    self.example = __import__(moduleName)
