Skip to content

Commit

Permalink
MAINT: allow users to import id constants from api (#508)
Browse files Browse the repository at this point in the history
Import ids constants in api, allow downstream users to import them from
envisage.api.

Closes #506

---------

Co-authored-by: Chengyu Liu <cyliu@aus552cyliu.local>
Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
  • Loading branch information
3 people committed Mar 10, 2023
1 parent 02b4811 commit 011c9cf
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
23 changes: 22 additions & 1 deletion envisage/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,19 @@
- :class:`~.IPluginManager`
- :class:`~.IServiceRegistry`
Constants
---------
- :data:`~.BINDINGS`
- :data:`~.COMMANDS`
- :data:`~.PREFERENCES`
- :data:`~.PREFERENCES_CATEGORIES`
- :data:`~.PREFERENCES_PANES`
- :data:`~.SERVICE_OFFERS`
- :data:`~.TASKS`
- :data:`~.TASK_EXTENSIONS`
Application, plugin and related classes
------------------------------------------
---------------------------------------
- :class:`~.Application`
- :class:`~.CorePlugin`
- :class:`~.EggPluginManager`
Expand Down Expand Up @@ -76,6 +87,16 @@
)
from .extension_provider import ExtensionProvider
from .extension_point_changed_event import ExtensionPointChangedEvent
from .ids import (
BINDINGS,
COMMANDS,
PREFERENCES,
PREFERENCES_CATEGORIES,
PREFERENCES_PANES,
SERVICE_OFFERS,
TASKS,
TASK_EXTENSIONS
)
from .import_manager import ImportManager
from .plugin import Plugin
from .plugin_activator import PluginActivator
Expand Down
28 changes: 28 additions & 0 deletions envisage/tests/test_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# (C) Copyright 2007-2023 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
#
# Thanks for using Enthought open source!

import unittest

import envisage.api as api
import envisage.ids as ids


class TestApi(unittest.TestCase):
""" Test for API """
def test_import(self):
self.assertEqual(api.BINDINGS, ids.BINDINGS)
self.assertEqual(api.COMMANDS, ids.COMMANDS)
self.assertEqual(api.PREFERENCES, ids.PREFERENCES)
self.assertEqual(api.PREFERENCES_CATEGORIES,
ids.PREFERENCES_CATEGORIES)
self.assertEqual(api.PREFERENCES_PANES, ids.PREFERENCES_PANES)
self.assertEqual(api.SERVICE_OFFERS, ids.SERVICE_OFFERS)
self.assertEqual(api.TASKS, ids.TASKS)
self.assertEqual(api.TASK_EXTENSIONS, ids.TASK_EXTENSIONS)

0 comments on commit 011c9cf

Please sign in to comment.