You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@bloodhound.apache.org by Ryan Ollos <ry...@wandisco.com> on 2013/07/16 20:23:06 UTC

Failing unit test in Trac

There's a single failing unit test when I run the tests manually, and I'm
hoping to get some advice on how to fix it. As a side note, this issue
seems unrelated to the failure of the unit test run on the server, which
seems to be caused by a failure to import Genshi.
http://ci.apache.org/builders/bh-unit-tests/builds/96/steps/trac%20unit-tests/logs/stdio

The failure I'm seeing appears to be caused by
trac.versioncontrol.api.DbRepositoryProvider not being enabled when
trac.admin.tests.console.TracadminTestCase executes.  DbRepositoryProvider
implements IAdminCommandProvider and since it is not enabled there are
several commands missing from the expected output of the trac-admin $env
help command.

I see that multiproduct.versioncontrol.DbRepositoryProvider inherits from
trac.versioncontrol.api.DbRepositoryProvider and in the production
environment the latter will not be enabled, however I'm not sure if/how
this is or should be affecting the unit test run.

As an experiment, I found that enabling `multiproduct.versioncontrol.*` in
the EnvironmentStub for the test execution will fix the issue and result in
all of the unit tests passing, however this doesn't seem like the right
change to make, so I ask for advice on how to proceed.

Index: trac/admin/tests/console.py
===================================================================
--- trac/admin/tests/console.py    (revision 1503481)
+++ trac/admin/tests/console.py    (working copy)
@@ -82,7 +82,7 @@
             '===== (test_[^ ]+) =====')

     def setUp(self):
-        self.env = EnvironmentStub(default_data=True, enable=('trac.*',),
+        self.env = EnvironmentStub(default_data=True, enable=('trac.*',
'multiproduct.versioncontrol.*'),
                                    disable=('trac.tests.*',))
         self._admin = console.TracAdmin()
         self._admin.env_set('', self.env)


----

(bh)user@ubuntu:~/Workspace/bh579/bloodhound/trac$ PYTHONPATH=. python
./trac/admin/tests/__init__.py
...............F............................................................................................
======================================================================
FAIL: test_help_ok (trac.admin.tests.console.TracadminTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File
"/home/user/Workspace/bh579/bloodhound/trac/trac/admin/tests/console.py",
line 162, in test_help_ok
    self.assertEqual(expected_results, output)
  File
"/home/user/Workspace/bh579/bloodhound/trac/trac/admin/tests/console.py",
line 145, in assertEqual
    output, diff()))

Re: Failing unit test in Trac

Posted by Olemis Lang <ol...@gmail.com>.
On 7/16/13, Ryan Ollos <ry...@wandisco.com> wrote:
>
[...]
>
> As an experiment, I found that enabling `multiproduct.versioncontrol.*` in
> the EnvironmentStub for the test execution will fix the issue and result in
> all of the unit tests passing, however this doesn't seem like the right
> change to make, so I ask for advice on how to proceed.
>
> Index: trac/admin/tests/console.py
> ===================================================================
> --- trac/admin/tests/console.py    (revision 1503481)
> +++ trac/admin/tests/console.py    (working copy)
> @@ -82,7 +82,7 @@
>              '===== (test_[^ ]+) =====')
>
>      def setUp(self):
> -        self.env = EnvironmentStub(default_data=True, enable=('trac.*',),
> +        self.env = EnvironmentStub(default_data=True, enable=('trac.*',
> 'multiproduct.versioncontrol.*'),
>                                     disable=('trac.tests.*',))
>          self._admin = console.TracAdmin()
>          self._admin.env_set('', self.env)
>

Is there a chance to apply this change in multiproduct test suite ?
That'd be the right place to tweak test cases this way.

[...]

-- 
Regards,

Olemis.