Rev 2: Add useful attributes to PluginInfo. in http://people.ubuntu.com/~robertc/baz2.0/plugins/plugin_info/trunk
Robert Collins
robertc at robertcollins.net
Fri Feb 29 12:10:10 GMT 2008
At http://people.ubuntu.com/~robertc/baz2.0/plugins/plugin_info/trunk
------------------------------------------------------------
revno: 2
revision-id:robertc at robertcollins.net-20080229121009-b0o16yv1pm22nhpz
parent: robertc at robertcollins.net-20080229113716-buc0cthtvvz7u987
committer: Robert Collins <robertc at robertcollins.net>
branch nick: trunk
timestamp: Fri 2008-02-29 23:10:09 +1100
message:
Add useful attributes to PluginInfo.
added:
extract.py extract.py-20080229115650-cgv523um54o9zvew-1
tests/test_extract.py test_extract.py-20080229115650-cgv523um54o9zvew-2
modified:
NEWS news-20080229113630-0dhvipp22wlcjolw-2
__init__.py __init__.py-20080229113630-0dhvipp22wlcjolw-4
tests/__init__.py __init__.py-20080229113630-0dhvipp22wlcjolw-7
=== modified file 'NEWS'
--- a/NEWS 2008-02-29 11:37:16 +0000
+++ b/NEWS 2008-02-29 12:10:09 +0000
@@ -23,3 +23,5 @@
INTERNALS:
+ * New class ``extract.PluginInfo`` for reporting extraction results.
+ (Robert Collins)
=== modified file '__init__.py'
--- a/__init__.py 2008-02-29 11:37:16 +0000
+++ b/__init__.py 2008-02-29 12:10:09 +0000
@@ -19,6 +19,8 @@
Currently no new commands are added, but various library facilities in
bzrlib.plugins.plugin_info.
+
+:seealso: bzrlib.plugins.plugin_info.extract
"""
version_info = (1, 3, 0, 'dev', 0)
=== added file 'extract.py'
--- a/extract.py 1970-01-01 00:00:00 +0000
+++ b/extract.py 2008-02-29 12:10:09 +0000
@@ -0,0 +1,35 @@
+# plugin_info, a plugin for working with information about plugins.
+# Copyright (C) 2008 Canonical Limited.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+"""Extraction of plugin data from a plugin."""
+
+__all__ = ['PluginInfo']
+
+class PluginInfo(object):
+ """Information about a plugin."""
+
+ def __init__(self):
+ """Create a PluginInfo instance."""
+ self.name = None
+ self.commands = []
+ self.version_info = None
+ self.minimum_bzr_version = None
+ self.maximum_bzr_version = None
+ self.control_formats = {}
+ self.checkout_formats = {}
+ self.branch_formats = {}
+ self.repository_formats = {}
=== modified file 'tests/__init__.py'
--- a/tests/__init__.py 2008-02-29 11:37:16 +0000
+++ b/tests/__init__.py 2008-02-29 12:10:09 +0000
@@ -21,6 +21,7 @@
def load_tests(standard_tests, module, loader):
test_modules = [
+ 'extract',
]
standard_tests.addTests(loader.loadTestsFromModuleNames(
['bzrlib.plugins.plugin_info.tests.test_' + name for
=== added file 'tests/test_extract.py'
--- a/tests/test_extract.py 1970-01-01 00:00:00 +0000
+++ b/tests/test_extract.py 2008-02-29 12:10:09 +0000
@@ -0,0 +1,39 @@
+# plugin_info, a plugin for working with information about plugins.
+# Copyright (C) 2008 Canonical Limited.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+"""Tests for extracting data from a plugin."""
+
+from bzrlib.plugins.plugin_info.extract import *
+from bzrlib.tests import TestCaseWithTransport
+
+
+class TestPluginInfo(TestCaseWithTransport):
+
+ def test_construct(self):
+ plugin = PluginInfo()
+
+ def test_defaults(self):
+ plugin = PluginInfo()
+ self.assertEqual(None, plugin.name)
+ self.assertEqual([], plugin.commands)
+ self.assertEqual(None, plugin.version_info)
+ self.assertEqual(None, plugin.minimum_bzr_version)
+ self.assertEqual(None, plugin.maximum_bzr_version)
+ self.assertEqual({}, plugin.control_formats)
+ self.assertEqual({}, plugin.checkout_formats)
+ self.assertEqual({}, plugin.branch_formats)
+ self.assertEqual({}, plugin.repository_formats)
More information about the bazaar-commits
mailing list