[Freeipa-devel] [patch 0006] ipalib: pass api instance into textui in doctest snippets

2015-07-10 Thread Milan Kubik

Hi,

the recent set of patches that modified api broke the tests that are 
included in ipalib/cli.py


This patch fixes the problems by passing api instance to textui() calls.

Milan
From 5df216ad49c6787a6e170a483c545d0fdcc99828 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Milan=20Kub=C3=ADk?= mku...@redhat.com
Date: Fri, 10 Jul 2015 11:56:02 +0200
Subject: [PATCH] ipalib: pass api instance into textui in doctest snippets

---
 ipalib/cli.py | 25 +
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/ipalib/cli.py b/ipalib/cli.py
index b260ca65172dab7ba56a23b78c086f49f5c18f70..4104e6482e4e713d701c6c1a4313ab6ecc899057 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -50,6 +50,7 @@ from errors import (PublicError, CommandError, HelpError, InternalError,
 from constants import CLI_TAB, LDAP_GENERALIZED_TIME_FORMAT
 from parameters import File, Str, Enum, Any, Flag
 from text import _
+from ipalib import api
 from ipapython.version import API_VERSION
 from ipapython.dnsutil import DNSName
 
@@ -100,7 +101,7 @@ class textui(backend.Backend):
 
 For example:
 
- ui = textui()
+ ui = textui(api)
  rows = [
 ... ('a', 'package'),
 ... ('an', 'egg'),
@@ -178,7 +179,7 @@ class textui(backend.Backend):
 
 For example:
 
- ui = textui()
+ ui = textui(api)
  ui.print_line('This line can fit!', width=18)
 This line can fit!
  ui.print_line('This line wont quite fit!', width=18)
@@ -204,7 +205,7 @@ class textui(backend.Backend):
 ... Python is a dynamic object-oriented programming language that can
 ... be used for many kinds of software development.
 ... '''
- ui = textui()
+ ui = textui(api)
  ui.print_paragraph(text, width=45)
 Python is a dynamic object-oriented
 programming language that can be used for
@@ -229,7 +230,7 @@ class textui(backend.Backend):
 
 For example:
 
- ui = textui()
+ ui = textui(api)
  ui.print_indented('One indentation level.')
   One indentation level.
  ui.print_indented('Two indentation levels.', indent=2)
@@ -249,7 +250,7 @@ class textui(backend.Backend):
 ... ('in_server', True),
 ... ('mode', u'production'),
 ... ]
- ui = textui()
+ ui = textui(api)
  ui.print_keyval(items)
   in_server = True
   mode = u'production'
@@ -269,7 +270,7 @@ class textui(backend.Backend):
 For example:
 
  attr = 'dn'
- ui = textui()
+ ui = textui(api)
  ui.print_attribute(attr, u'dc=example,dc=com')
   dn: dc=example,dc=com
  attr = 'objectClass'
@@ -407,7 +408,7 @@ class textui(backend.Backend):
 
 For example:
 
- ui = textui()
+ ui = textui(api)
  ui.print_dashed('Dashed above and below.')
 ---
 Dashed above and below.
@@ -434,7 +435,7 @@ class textui(backend.Backend):
 
 For example:
 
- ui = textui()
+ ui = textui(api)
  ui.print_h1('A primary header')
 
 A primary header
@@ -448,7 +449,7 @@ class textui(backend.Backend):
 
 For example:
 
- ui = textui()
+ ui = textui(api)
  ui.print_h2('A secondary header')
   --
   A secondary header
@@ -464,7 +465,7 @@ class textui(backend.Backend):
 command.  For example, a hypothetical ``show_status`` command would
 output something like this:
 
- ui = textui()
+ ui = textui(api)
  ui.print_name('show_status')
 
 show-status:
@@ -481,7 +482,7 @@ class textui(backend.Backend):
 
 For example:
 
- ui = textui()
+ ui = textui(api)
  ui.print_summary('Added user jdoe')
 -
 Added user jdoe
@@ -500,7 +501,7 @@ class textui(backend.Backend):
 
 For example:
 
- ui = textui()
+ ui = textui(api)
  ui.print_count(1, '%d goose', '%d geese')
 ---
 1 goose
-- 
1.9.3

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Re: [Freeipa-devel] [patch 0006] ipalib: pass api instance into textui in doctest snippets

2015-07-10 Thread Milan Kubik

On 07/10/2015 01:57 PM, Milan Kubik wrote:

Hi,

the recent set of patches that modified api broke the tests that are 
included in ipalib/cli.py


This patch fixes the problems by passing api instance to textui() calls.

Milan


This may not be the complete solution. Similar problems arise in the 
rest of the tests in ipalib modules.
I guess the code examples (doctest test cases) are all affected by the 
changes to the api object.
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Re: [Freeipa-devel] [patch 0006] ipalib: pass api instance into textui in doctest snippets

2015-07-10 Thread Tomas Babej


On 07/10/2015 02:15 PM, Milan Kubik wrote:
 On 07/10/2015 01:57 PM, Milan Kubik wrote:
 Hi,

 the recent set of patches that modified api broke the tests that are
 included in ipalib/cli.py

 This patch fixes the problems by passing api instance to textui() calls.

 Milan


 This may not be the complete solution. Similar problems arise in the
 rest of the tests in ipalib modules.
 I guess the code examples (doctest test cases) are all affected by the
 changes to the api object.
 
 

ACK for this patch.

Pushed to:
master: 61f41df9493acfbfd1cda017b40cf6786afd8815
ipa-4-2: c210b3d2843326e5bc934d397831d4d128c1b603

As far as the other modules go, I see most failures in the frontend:

../ipalib/__init__.py F
../ipalib/base.py .
../ipalib/cli.py 
../ipalib/config.py .
../ipalib/crud.py F
../ipalib/errors.py
.
../ipalib/frontend.py .FFF
../ipalib/messages.py .
../ipalib/output.py .
../ipalib/parameters.py ...
../ipalib/text.py ..

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code