def test_dynamically_added_preferences(self):

        # The core plugin is the plugin that offers the preferences extension
        # point.
        from envisage.core_plugin import CorePlugin

        class PluginA(Plugin):
            id = 'A'
            preferences = List(contributes_to='envisage.preferences')

            def _preferences_default(self):
                """ Trait initializer. """

                return ['file://' + resource_filename(PKG, 'preferences.ini')]

        core = CorePlugin()
        a    = PluginA()

        # Start with just the core plugin.
        application = TestApplication(plugins=[core])
        application.start()

        # Now add a plugin that contains a preference.
        application.add_plugin(a)

        # Make sure we can get one of the preferences.
        self.assertEqual('42', application.preferences.get('enthought.test.x'))

        return


# Entry point for stand-alone testing.
dynamically added preferences
dataset/ETHPy150Open enthought/envisage/envisage/tests/core_plugin_test_case.py/CorePluginTestCase.test_dynamically_added_preferences