'Check that L{plugin.getPlugins} is able to detect plugins added at
runtime.'

def test_detectNewFiles(self):

    FilePath(__file__).sibling('plugin_extra1.py').copyTo(self.package.child('pluginextra.py'))
    try:
        self.failIfIn('mypackage.pluginextra', sys.modules)
        self.assertFalse(hasattr(sys.modules['mypackage'], 'pluginextra'), 'mypackage    still    has    pluginextra    module')
        plgs = list(plugin.getPlugins(ITestPlugin, self.module))
        self.assertEqual(len(plgs), 2)
        names = ['TestPlugin', 'FourthTestPlugin']
        for p in plgs:
            names.remove(p.__name__)
            p.test1()
    finally:
        self._unimportPythonModule(sys.modules['mypackage.pluginextra'], True)
