This fixes two unit tests and 1 doctest, all pretty trivial breaks.

I hope no one minds too much, but I self-acked this and pushed it to
master because these broken tests are holding up my UI work a bit.

"""
Looks great, Jason! ack, pushed to master.

-Jason
"""
>From 22493eef216a587bf076f81e558c476b6dd513bf Mon Sep 17 00:00:00 2001
From: Jason Gerard DeRose <jder...@redhat.com>
Date: Tue, 4 Aug 2009 00:21:26 -0600
Subject: [PATCH] Fix three broken unit tests

---
 ipalib/backend.py    |    1 +
 ipalib/cli.py        |    3 +--
 ipalib/parameters.py |   15 +++++++--------
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/ipalib/backend.py b/ipalib/backend.py
index da7fc29..b123ed1 100644
--- a/ipalib/backend.py
+++ b/ipalib/backend.py
@@ -118,6 +118,7 @@ class Executioner(Backend):
                 'non-public: %s: %s', e.__class__.__name__, str(e)
             )
             error = InternalError()
+        destroy_context()
         if error is None:
             return result
         assert isinstance(error, PublicError)
diff --git a/ipalib/cli.py b/ipalib/cli.py
index 07e540e..3258556 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -246,8 +246,7 @@ class textui(backend.Backend):
           dn: dc=example,dc=com
         >>> attr = 'objectClass'
         >>> ui.print_attribute(attr, [u'top', u'someClass'])
-          objectClass: top
-          objectClass: someClass
+          objectClass: top, someClass
         """
         assert isinstance(attr, basestring)
         if not isinstance(value, (list, tuple)):
diff --git a/ipalib/parameters.py b/ipalib/parameters.py
index d9e33f8..1b3b2b7 100644
--- a/ipalib/parameters.py
+++ b/ipalib/parameters.py
@@ -261,13 +261,6 @@ class Param(ReadOnly):
         self.name = check_name(name)
         self.nice = '%s(%r)' % (self.__class__.__name__, self.param_spec)
 
-        if 'cli_short_name' in kw:
-            if len(kw['cli_short_name']) != 1:
-                raise TypeError(
-                    '%s: cli_short_name can only be a single character: %s'
-                    % (self.nice, kw['cli_short_name'])
-                )
-
         # Add 'default' to self.kwargs and makes sure no unknown kw were given:
         assert type(self.type) is type
         if kw.get('multivalue', True):
@@ -360,6 +353,13 @@ class Param(ReadOnly):
                     '%s: rules must be callable; got %r' % (self.nice, rule)
                 )
 
+        # Check that cli_short_name is only 1 character long:
+        if not (self.cli_short_name is None or len(self.cli_short_name) == 1):
+            raise ValueError(
+                '%s: cli_short_name can only be a single character: %s' % (
+                    self.nice, self.cli_short_name)
+            )
+
         # And we're done.
         lock(self)
 
@@ -1244,4 +1244,3 @@ def create_param(spec):
             TYPE_ERROR % ('spec', (str, Param), spec, type(spec))
         )
     return Str(spec)
-
-- 
1.6.0.4

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to