Re: [Apache Bloodhound] #771: Improve test case coverage for trac-admin command

2014-02-26 Thread Apache Bloodhound
#771: Improve test case coverage for trac-admin command
---+---
  Reporter:  rjollos   |  Owner:  nobody
  Type:  defect| Status:  new
  Priority:  major |  Milestone:  Release 9
 Component:  multiproduct  |Version:
Resolution:|   Keywords:
---+---
Description changed by rjollos:

Old description:

> This ticket will explore how we can improve test coverage to avoid
> defects like those in #756 and #757.
>
> After tests were added in r1572372, only one failure is seen, with the
> method that is run on the global environment: `test_product_help_ok`. The
> tests in `test_product_help_version` and `test_product_help_version_add`
> should have failed if they were run against a global environment, but
> don't fail because they are run directly against a product environment.
> This is not realistic, because when `trac-admin` is called, it is called
> on a global environment and the command is dispatched to the product
> environment (this may be a poor way to describe what is actually
> happening, and I'll try to refine the description as I investigate
> further).
>
> The test in r1572374 has the same issue. It should fail if executed
> against the global environment, but it doesn't fail since it's execute
> against the product environment.
>
> Action items are:
>  1. In trac:#11502, test case coverage will be improved in the Trac core.
> The test methods `test_product_help_version` and
> `test_product_help_version_add` added in r1572372 will be back-ported.
>  1. Refactoring in trac:#11500 needs to be integrated.
>  1. Modify test harness so that tests are executed in the global
> environment. An initial patch is attached: attachment:t771-r1572373.diff.
> The patch will likely be refined, after trac:#11500 and trac:#11502 are
> integrated in Bloodhound.

New description:

 This ticket will explore how we can improve test coverage to avoid defects
 like those in #756 and #757.

 After tests were added in r1572372, only one failure is seen, with the
 method that is run on the global environment: `test_product_help_ok`. The
 tests in `test_product_help_version` and `test_product_help_version_add`
 should have failed if they were run against a global environment, but
 don't fail because they are run directly against a product environment.
 This is not realistic, because when `trac-admin` is called, it is called
 on a global environment and the command is dispatched to the product
 environment (this may be a poor way to describe what is actually
 happening, and I'll try to refine the description as I investigate
 further).

 The test in r1572374 has the same issue. It should fail if executed
 against the global environment, but it doesn't fail since it's execute
 against the product environment.

 Action items are:
  1. In trac:#11502, test case coverage will be improved in the Trac core.
 The test methods `test_product_help_version` and
 `test_product_help_version_add` added in r1572372 will be back-ported.
  1. Refactoring in trac:#11500 needs to be integrated.
  1. Modify test harness so that tests are executed in the global
 environment. An initial patch is attached: attachment:t771-r1572399.diff.
 The patch will likely be refined, after trac:#11500 and trac:#11502 are
 integrated in Bloodhound.

--

-- 
Ticket URL: 
Apache Bloodhound 
The Apache Bloodhound issue tracker


Re: [Apache Bloodhound] #756: Unhelpful errors from product-scoped commands in console admin

2014-02-26 Thread Apache Bloodhound
#756: Unhelpful errors from product-scoped commands in console admin
---+---
  Reporter:  rjollos   |  Owner:  olemis
  Type:  enhancement   | Status:  closed
  Priority:  major |  Milestone:  Release 8
 Component:  multiproduct  |Version:
Resolution:  fixed |   Keywords:  console admin
---+---

Comment (by rjollos):

 Replying to [comment:3 olemis]:
 > Open question :
 >
 >   - Should suggested command be «product admin  » ?

 We may want to consider this in #764.

-- 
Ticket URL: 
Apache Bloodhound 
The Apache Bloodhound issue tracker


svn commit: r1572392 - /bloodhound/trunk/bloodhound_multiproduct/tests/admin/console.py

2014-02-26 Thread rjollos
Author: rjollos
Date: Thu Feb 27 01:53:35 2014
New Revision: 1572392

URL: http://svn.apache.org/r1572392
Log:
0.8dev: Removed unused imports.

Modified:
bloodhound/trunk/bloodhound_multiproduct/tests/admin/console.py

Modified: bloodhound/trunk/bloodhound_multiproduct/tests/admin/console.py
URL: 
http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_multiproduct/tests/admin/console.py?rev=1572392&r1=1572391&r2=1572392&view=diff
==
--- bloodhound/trunk/bloodhound_multiproduct/tests/admin/console.py (original)
+++ bloodhound/trunk/bloodhound_multiproduct/tests/admin/console.py Thu Feb 27 
01:53:35 2014
@@ -22,10 +22,8 @@
 import os.path
 import sys
 import unittest
-from StringIO import StringIO
 
-from trac.admin.tests.console import STRIP_TRAILING_SPACE, \
- TracadminTestCase, load_expected_results
+from trac.admin.tests.console import TracadminTestCase, load_expected_results
 
 from multiproduct.env import ProductEnvironment
 from tests.env import MultiproductTestCase
@@ -94,7 +92,7 @@ class ProductTracAdminTestCase(Tracadmin
 def test_suite():
 return unittest.TestSuite([
 unittest.makeSuite(ProductTracAdminTestCase),
-])
+])
 
 
 if __name__ == '__main__':




[Apache Bloodhound] #771: Improve test case coverage for trac-admin command

2014-02-26 Thread Apache Bloodhound
#771: Improve test case coverage for trac-admin command
--+---
 Reporter:  rjollos   |  Owner:  nobody
 Type:  defect| Status:  new
 Priority:  major |  Milestone:  Release 9
Component:  multiproduct  |Version:
 Keywords:|
--+---
 This ticket will explore how we can improve test coverage to avoid defects
 like those in #756 and #757.

 After tests were added in r1572372, only one failure is seen, with the
 method that is run on the global environment: `test_product_help_ok`. The
 tests in `test_product_help_version` and `test_product_help_version_add`
 should have failed if they were run against a global environment, but
 don't fail because they are run directly against a product environment.
 This is not realistic, because when `trac-admin` is called, it is called
 on a global environment and the command is dispatched to the product
 environment (this may be a poor way to describe what is actually
 happening, and I'll try to refine the description as I investigate
 further).

 The test in r1572374 has the same issue. It should fail if executed
 against the global environment, but it doesn't fail since it's execute
 against the product environment.

 Action items are:
  1. In trac:#11502, test case coverage will be improved in the Trac core.
 The test methods `test_product_help_version` and
 `test_product_help_version_add` added in r1572372 will be back-ported.
  1. Refactoring in trac:#11500 needs to be integrated.
  1. Modify test harness so that tests are executed in the global
 environment. An initial patch is attached: attachment:t771-r1572373.diff.
 The patch will likely be refined, after trac:#11500 and trac:#11502 are
 integrated in Bloodhound.

-- 
Ticket URL: 
Apache Bloodhound 
The Apache Bloodhound issue tracker


Re: [Apache Bloodhound] #756: Unhelpful errors from product-scoped commands in console admin

2014-02-26 Thread Apache Bloodhound
#756: Unhelpful errors from product-scoped commands in console admin
---+---
  Reporter:  rjollos   |  Owner:  olemis
  Type:  enhancement   | Status:  closed
  Priority:  major |  Milestone:  Release 8
 Component:  multiproduct  |Version:
Resolution:  fixed |   Keywords:  console admin
---+---
Changes (by rjollos):

 * owner:  rjollos => olemis


-- 
Ticket URL: 
Apache Bloodhound 
The Apache Bloodhound issue tracker


Re: [Apache Bloodhound] #756: Unhelpful errors from product-scoped commands in console admin

2014-02-26 Thread Apache Bloodhound
#756: Unhelpful errors from product-scoped commands in console admin
---+---
  Reporter:  rjollos   |  Owner:  rjollos
  Type:  enhancement   | Status:  closed
  Priority:  major |  Milestone:  Release 8
 Component:  multiproduct  |Version:
Resolution:  fixed |   Keywords:  console admin
---+---
Changes (by rjollos):

 * status:  review => closed
 * resolution:   => fixed


Comment:

 (In [1572374])

 0.8dev: Added tests for output of help when `trac-admin` is called at
 product-scope with improper arguments. Refs #756.

 

 (In [1572376])

 0.8dev: Fix for help not being output when `trac-admin` commands are
 called at product scope with incorrect arguments. Refs #756.

 Patch by Olemis Lang.

-- 
Ticket URL: 
Apache Bloodhound 
The Apache Bloodhound issue tracker


svn commit: r1572376 - /bloodhound/trunk/bloodhound_multiproduct/multiproduct/product_admin.py

2014-02-26 Thread rjollos
Author: rjollos
Date: Thu Feb 27 01:23:14 2014
New Revision: 1572376

URL: http://svn.apache.org/r1572376
Log:
0.8dev: Fix for help not being output when `trac-admin` commands are called at 
product scope with incorrect arguments. Refs #757.

Patch by Olemis Lang.

Modified:
bloodhound/trunk/bloodhound_multiproduct/multiproduct/product_admin.py

Modified: bloodhound/trunk/bloodhound_multiproduct/multiproduct/product_admin.py
URL: 
http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_multiproduct/multiproduct/product_admin.py?rev=1572376&r1=1572375&r2=1572376&view=diff
==
--- bloodhound/trunk/bloodhound_multiproduct/multiproduct/product_admin.py 
(original)
+++ bloodhound/trunk/bloodhound_multiproduct/multiproduct/product_admin.py Thu 
Feb 27 01:23:14 2014
@@ -332,7 +332,15 @@ class ProductAdminModule(Component):
 env = mgr.env
 TracAdmin.print_doc(TracAdmin.all_docs(env), short=True)
 else:
-mgr.execute_command(*args)
+try:
+mgr.execute_command(*args)
+except AdminCommandError, e:
+printerr(_("Error: %(msg)s", msg=to_unicode(e)))
+if e.show_usage:
+print
+self._do_product_admin(prefix, 'help', *args[:2])
+except:
+raise
 
 # IRequestFilter methods
 def pre_process_request(self, req, handler):




svn commit: r1572374 - in /bloodhound/trunk/bloodhound_multiproduct/tests/admin: console-tests.txt console.py

2014-02-26 Thread rjollos
Author: rjollos
Date: Thu Feb 27 01:20:23 2014
New Revision: 1572374

URL: http://svn.apache.org/r1572374
Log:
0.8dev: Added tests for output of help when `trac-admin` is called at 
product-scope with improper arguments. Refs #756.

Modified:
bloodhound/trunk/bloodhound_multiproduct/tests/admin/console-tests.txt
bloodhound/trunk/bloodhound_multiproduct/tests/admin/console.py

Modified: bloodhound/trunk/bloodhound_multiproduct/tests/admin/console-tests.txt
URL: 
http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_multiproduct/tests/admin/console-tests.txt?rev=1572374&r1=1572373&r2=1572374&view=diff
==
--- bloodhound/trunk/bloodhound_multiproduct/tests/admin/console-tests.txt 
(original)
+++ bloodhound/trunk/bloodhound_multiproduct/tests/admin/console-tests.txt Thu 
Feb 27 01:20:23 2014
@@ -1127,3 +1127,10 @@ version add  [time]
 
 Add version
 
+= test_product_fail_version_add =
+Error: Invalid arguments
+
+version add  [time]
+
+Add version
+

Modified: bloodhound/trunk/bloodhound_multiproduct/tests/admin/console.py
URL: 
http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_multiproduct/tests/admin/console.py?rev=1572374&r1=1572373&r2=1572374&view=diff
==
--- bloodhound/trunk/bloodhound_multiproduct/tests/admin/console.py (original)
+++ bloodhound/trunk/bloodhound_multiproduct/tests/admin/console.py Thu Feb 27 
01:20:23 2014
@@ -84,6 +84,12 @@ class ProductTracAdminTestCase(Tracadmin
 expected = self.expected_results[self._testMethodName]
 self.assertEqual(expected, output)
 
+def test_product_fail_version_add(self):
+rv, output = self._execute('version add v x y')
+self.assertEqual(2, rv)
+expected = self.expected_results[self._testMethodName]
+self.assertEqual(expected, output)
+
 
 def test_suite():
 return unittest.TestSuite([




Re: [Apache Bloodhound] #757: [Regression] TracAdmin help command 0.8-dev

2014-02-26 Thread Apache Bloodhound
#757: [Regression] TracAdmin help command 0.8-dev
---+---
  Reporter:  olemis|  Owner:  rjollos
  Type:  defect| Status:  closed
  Priority:  major |  Milestone:  Release 8
 Component:  multiproduct  |Version:  0.8.0dev
Resolution:  fixed |   Keywords:  admin
---+---
Changes (by rjollos):

 * status:  review => closed
 * resolution:   => fixed


Comment:

 (In [1572372])

 0.8dev: Added tests for help command at product scope. Refs #757.

 

 (In [1572373])

 0.8dev: Fix for help commands at product scope not being output. Refs
 #757.

 Patch by Olemis Lang.

-- 
Ticket URL: 
Apache Bloodhound 
The Apache Bloodhound issue tracker


Re: [Apache Bloodhound] #757: [Regression] TracAdmin help command 0.8-dev

2014-02-26 Thread Apache Bloodhound
#757: [Regression] TracAdmin help command 0.8-dev
---+---
  Reporter:  olemis|  Owner:  olemis
  Type:  defect| Status:  closed
  Priority:  major |  Milestone:  Release 8
 Component:  multiproduct  |Version:  0.8.0dev
Resolution:  fixed |   Keywords:  admin
---+---
Changes (by rjollos):

 * owner:  rjollos => olemis


-- 
Ticket URL: 
Apache Bloodhound 
The Apache Bloodhound issue tracker


svn commit: r1572373 - /bloodhound/trunk/bloodhound_multiproduct/multiproduct/product_admin.py

2014-02-26 Thread rjollos
Author: rjollos
Date: Thu Feb 27 01:15:23 2014
New Revision: 1572373

URL: http://svn.apache.org/r1572373
Log:
0.8dev: Fix for help commands at product scope not being output. Refs #757.

Patch by Olemis Lang.

Modified:
bloodhound/trunk/bloodhound_multiproduct/multiproduct/product_admin.py

Modified: bloodhound/trunk/bloodhound_multiproduct/multiproduct/product_admin.py
URL: 
http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_multiproduct/multiproduct/product_admin.py?rev=1572373&r1=1572372&r2=1572373&view=diff
==
--- bloodhound/trunk/bloodhound_multiproduct/multiproduct/product_admin.py 
(original)
+++ bloodhound/trunk/bloodhound_multiproduct/multiproduct/product_admin.py Thu 
Feb 27 01:15:23 2014
@@ -301,7 +301,7 @@ class ProductAdminModule(Component):
 mgr = self.product_admincmd_mgr(args[0])
 return mgr.complete_command(args[1:])
 
-GLOBAL_COMMANDS = ('deploy', 'help', 'hotcopy', 'initenv', 'upgrade')
+GLOBAL_COMMANDS = ('deploy', 'hotcopy', 'initenv', 'upgrade')
 
 def _do_product_admin(self, prefix, *args):
 mgr = self.product_admincmd_mgr(prefix)




svn commit: r1572372 - in /bloodhound/trunk/bloodhound_multiproduct/tests/admin: console-tests.txt console.py

2014-02-26 Thread rjollos
Author: rjollos
Date: Thu Feb 27 01:14:18 2014
New Revision: 1572372

URL: http://svn.apache.org/r1572372
Log:
0.8dev: Added tests for help command at product scope. Refs #757.

Modified:
bloodhound/trunk/bloodhound_multiproduct/tests/admin/console-tests.txt
bloodhound/trunk/bloodhound_multiproduct/tests/admin/console.py

Modified: bloodhound/trunk/bloodhound_multiproduct/tests/admin/console-tests.txt
URL: 
http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_multiproduct/tests/admin/console-tests.txt?rev=1572372&r1=1572371&r2=1572372&view=diff
==
--- bloodhound/trunk/bloodhound_multiproduct/tests/admin/console-tests.txt 
(original)
+++ bloodhound/trunk/bloodhound_multiproduct/tests/admin/console-tests.txt Thu 
Feb 27 01:14:18 2014
@@ -1022,3 +1022,108 @@ name17  0 2010-01-18  val17  val17
 name18  0 2010-01-19  val18  val18
 name19  0 2010-01-20  val19  val19
 
+= test_product_help_ok =
+trac-admin - The Trac Administration Console 1.0.1
+help Show documentation
+initenv  Create and initialize a new environment
+attachment add   Attach a file to a resource
+attachment exportExport an attachment from a resource to a file or stdout
+attachment list  List attachments of a resource
+attachment removeRemove an attachment from a resource
+changeset added  Notify trac about changesets added to a repository
+changeset modified   Notify trac about changesets modified in a repository
+component addAdd a new component
+component chown  Change component ownership
+component list   Show available components
+component remove Remove/uninstall a component
+component rename Rename a component
+config get   Get the value of the given option in "trac.ini"
+config removeRemove the specified option from "trac.ini"
+config set   Set the value for the given option in "trac.ini"
+deploy   Extract static resources from Trac and all plugins
+hotcopy  Make a hot backup copy of an environment
+milestone addAdd milestone
+milestone completed  Set milestone complete date
+milestone dueSet milestone due date
+milestone list   Show milestones
+milestone remove Remove milestone
+milestone rename Rename milestone
+permission add   Add a new permission rule
+permission exportExport permission rules to a file or stdout as CSV
+permission importImport permission rules from a file or stdin as CSV
+permission list  List permission rules
+permission removeRemove a permission rule
+priority add Add a priority value option
+priority change  Change a priority value
+priority listShow possible ticket priorities
+priority order   Move a priority value up or down in the list
+priority remove  Remove a priority value
+repository add   Add a source repository
+repository alias Create an alias for a repository
+repository list  List source repositories
+repository removeRemove a source repository
+repository resyncRe-synchronize trac with repositories
+repository set   Set an attribute of a repository
+repository sync  Resume synchronization of repositories
+resolution add   Add a resolution value option
+resolution changeChange a resolution value
+resolution list  Show possible ticket resolutions
+resolution order Move a resolution value up or down in the list
+resolution removeRemove a resolution value
+session add  Create a session for the given sid
+session delete   Delete the session of the specified sid
+session list List the name and email for the given sids
+session purgePurge all anonymous sessions older than the given age
+session set  Set the name or email attribute of the given sid
+severity add Add a severity value option
+severity change  Change a severity value
+severity listShow possible ticket severities
+severity order   Move a severity value up or down in the list
+severity remove  Remove a severity value
+ticket removeRemove ticket
+ticket_type add  Add a ticket type
+ticket_type change   Change a ticket type
+ticket_type list Show possible ticket types
+ticket_type orderMove a ticket type up or down in the list
+ticket_type remove   Remove a ticket type
+upgrade  Upgrade database to current version
+version add  Add version
+version list Show versions
+version remove   Remove version
+version rename   Rename version
+version time Set version date
+wiki dumpExport wiki pages to files named by title
+wiki export  Export wiki page to file or stdout
+wiki import  Import wiki page from file or stdin
+wiki listList wiki pages
+wiki loadImport wiki pages from files
+wiki remove  Remove wiki page
+wiki rename 

Re: [Apache Bloodhound] #770: Location of test cases for bloodhound_multiproduct is not consistent with other projects

2014-02-26 Thread Apache Bloodhound
#770: Location of test cases for bloodhound_multiproduct is not consistent with
other projects
---+
  Reporter:  rjollos   |  Owner:  nobody
  Type:  defect| Status:  new
  Priority:  major |  Milestone:
 Component:  multiproduct  |Version:
Resolution:|   Keywords:
---+

Comment (by rjollos):

 Do you have a reason other than just personal preference? Trac has already
 chosen to locate tests in a `tests` subdirectory of the module. In
 general, it is logical to maintain consistency with Trac on things like
 this (and code style issue), unless there is a solid argument to go a
 different direction, and the argument can cite significant advantages.

-- 
Ticket URL: 
Apache Bloodhound 
The Apache Bloodhound issue tracker


Re: [Apache Bloodhound] #770: Location of test cases for bloodhound_multiproduct is not consistent with other projects

2014-02-26 Thread Apache Bloodhound
#770: Location of test cases for bloodhound_multiproduct is not consistent with
other projects
---+
  Reporter:  rjollos   |  Owner:  nobody
  Type:  defect| Status:  new
  Priority:  major |  Milestone:
 Component:  multiproduct  |Version:
Resolution:|   Keywords:
---+

Comment (by olemis):

 Replying to [ticket:770 rjollos]:
 [...]
 > For the `bloodhound_multiproduct` project, the tests are located in a
 parallel tree with a different root directory (and that's not even
 strictly the case, considering `multiproduct/product_admin.py` and
 `tests/admin/product_admin.py`).
 >
 > We should be consistent in the location of our tests across projects.

 If you ask me I'd rather prefer the option I kept above , though renaming
 the test module to something other than `tests` e.g. multiproduct_tests or
 bhmp_tests or ...

-- 
Ticket URL: 
Apache Bloodhound 
The Apache Bloodhound issue tracker


[Apache Bloodhound] #770: Location of test cases for bloodhound_multiproduct is not consistent with other projects

2014-02-26 Thread Apache Bloodhound
#770: Location of test cases for bloodhound_multiproduct is not consistent with
other projects
--+
 Reporter:  rjollos   |  Owner:  nobody
 Type:  defect| Status:  new
 Priority:  major |  Milestone:
Component:  multiproduct  |Version:
 Keywords:|
--+
 For the `bloodhound_search`, `bloodhound_relations` and
 `bloodhound_dashboard` projects, the test cases are located in the `tests`
 subdirectory of the module. For the `bloodhound_multiproduct` project, the
 tests are located in a parallel tree with a different root directory (and
 that's not even strictly the case, considering
 `multiproduct/product_admin.py` and `tests/admin/product_admin.py`).

 We should be consistent in the location of our tests across projects.

-- 
Ticket URL: 
Apache Bloodhound 
The Apache Bloodhound issue tracker