TestManagerForTracPlugin not working

104 views
Skip to first unread message

Robert Kuropkat

unread,
Jan 10, 2022, 2:09:45 PM1/10/22
to Trac Users
Hello,

Trying to install the Test Manager plugin (https://trac-hacks.org/wiki/TestManagerForTracPlugin) and can't seem to get it to work.  Searching implies it should be working, so I must have missed something obvious somewhere.

Trac: v1.4.3
TestManager: 1.9.1-py2.7
TracGenericClass: 1.1.7-py2.7
TracGenericWorkflow: 1.0.5.py2.7
Genshi: 0.7.5

CentOS: 8.4.2105
Python: 2.7.18

From trac.ini

[components]
tracgenericclass.* = enabled
tracgenericworkflow.* = enabled
testmanager.* = enabled

Permissions on egg files: 644

Apache restarted (multiple times)

Error in trac.log

Trac[loader] ERROR: Skipping "testmanager = testmanager": ImportError: cannot import name with_transaction

Any help appreciated.
Robert Kuropkat

RjOllos

unread,
Jan 11, 2022, 1:07:03 PM1/11/22
to Trac Users
The plugin isn't compatible with Trac 1.4 because it uses deprecated database access methods that have been removed:

Ryan 

Robert Kuropkat

unread,
Jan 11, 2022, 1:10:18 PM1/11/22
to trac-...@googlegroups.com
--


Dude.... I was afraid that would be the answer.  Is there a solid alternative?  I can use a separate product, but I was pretty excited about a built-in Trac option.  How difficult an upgrade would it be?  There was enough positive commentary on this plugin I might be willing to give it a go...

Robert Kuropkat


figaro

unread,
Jan 11, 2022, 4:27:42 PM1/11/22
to Trac Users
TestManagerForTracPlugin is one of the largest plugins that is publicly available and likely to be a large piece of work to migrate.
Depending on your use case, the only other option is https://trac-hacks.org/wiki/QaTrackerPlugin

-- figaro

Robert Kuropkat

unread,
Jan 12, 2022, 2:02:50 PM1/12/22
to trac-...@googlegroups.com


Installed QaTrackerPlugin to give it a try.  Created a Test Plan (Milestone) and a Test Case (Ticket) and assigned the Test Case to the Test Plan.  Tried to create a Test Run in the QA Tracker tab and got an error:

            AttributeError: 'Environment' object has no attribute 'get_db_cnx'

Robert Kuropkat

--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/1unaoUW2MdQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/f3450c2e-ca85-4d09-a21d-2cf037b60e08n%40googlegroups.com.

figaro

unread,
Jan 12, 2022, 4:11:14 PM1/12/22
to Trac Users
Thank you for your efforts nonetheless.
'get_db_cnx' happens to be deprecated, and that means that plugin will have to be upgraded too.
As far as I know, no other plugin has been developed and is available on trac-hacks that supports testing software.

-- figaro

Roberto Longobardi

unread,
Feb 7, 2022, 10:05:50 AM2/7/22
to Trac Users
Hi all,
I worked some hours trying to upgrade my TestManagerForTracPlugin to Python3 and the latest Trac, and after having fixed the deprecated db api and several other issues I found out that the Genshi template engine has been replaced with Jinja2 and the ITemplateStreamFilter is no longer supported. (BTW, the reason seems to be performance problems with Genshi... Actually we haven't ever faced any in our organization...)

Unfortunately, the plugin is heavily (if not completely) based on the ITemplateStreamFilter machanism, in order o decorate Wiki pages, and a bit also the Ticket pages, with the set of contents and controls related to test catalogs and test cases.
This allows users to leverage the power of the Wiki, and of any other plugins that augment it, while dealing with test descriptions and metadata.

Rewriting the plugin completely, to replace template filtering with JavaScript as recommended, besides being an awkward approach, is something I can't currently undergo, unfortunately.

Roberto

RjOllos

unread,
Feb 7, 2022, 10:08:52 AM2/7/22
to Trac Users
On Monday, February 7, 2022 at 7:05:50 AM UTC-8 sec...@gmail.com wrote:
Hi all,
I worked some hours trying to upgrade my TestManagerForTracPlugin to Python3 and the latest Trac, and after having fixed the deprecated db api and several other issues I found out that the Genshi template engine has been replaced with Jinja2 and the ITemplateStreamFilter is no longer supported. (BTW, the reason seems to be performance problems with Genshi... Actually we haven't ever faced any in our organization...)

Unfortunately, the plugin is heavily (if not completely) based on the ITemplateStreamFilter machanism, in order o decorate Wiki pages, and a bit also the Ticket pages, with the set of contents and controls related to test catalogs and test cases.
This allows users to leverage the power of the Wiki, and of any other plugins that augment it, while dealing with test descriptions and metadata.

Rewriting the plugin completely, to replace template filtering with JavaScript as recommended, besides being an awkward approach, is something I can't currently undergo, unfortunately.

Roberto

I would treat the 3 changes separately in this order:
1. Deprecated database API (Trac 1.2)
2. Port to Jinja2 (Trac 1.4)
3. Python3 (Trac 1.6)

If you complete just (1), you'll have compatibility with Trac 1.4, which still supports Genshi in most ways while recommending Jinja2.

Ryan

Robert Kuropkat

unread,
Feb 7, 2022, 10:24:04 AM2/7/22
to trac-...@googlegroups.com


I suspected as much.  Other plugins have complained about Genshi but I was able to install it and they worked.  So I can imagine some ongoing degradation there so long as a plugin requires it. 

I am still interested in looking into it and have forked the git repo here: https://github.com/robert-kuropkat/testman4trac just so I can tinker and learn without mucking up any other effort.

Robert

Robert Kuropkat

unread,
Feb 7, 2022, 10:26:47 AM2/7/22
to trac-...@googlegroups.com


Perhaps Roberto can publish his updates then.  I'd be willing to test them certainly.  I agree with the order of updates you suggest.  Python 3 is not even a particular interest of mine at the moment, though longer term it should be.  My installation is still running on Python2.

Robert Kuropkat

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/b5143843-d7d5-45d7-ae21-2d8142fa4698n%40googlegroups.com.

RjOllos

unread,
Feb 7, 2022, 2:08:22 PM2/7/22
to Trac Users
On Monday, February 7, 2022 at 7:26:47 AM UTC-8 robert....@gmail.com wrote:


Perhaps Roberto can publish his updates then.


That would be ideal. I'd love to contribute as time allows via GitHub of trac-hacks. With the code being on Sourceforge, I'm unsure if the code is really open for contributions.

Roberto Longobardi

unread,
Feb 7, 2022, 6:25:21 PM2/7/22
to Trac Users
Hi,
I've pushed my latest changes on both the sourceforge and the new GitHub repo: https://github.com/seccanj/testman4trac

After some tests on Trac 1.4 and Python 2.7 the changes look good.

Please, try them out and let me know if something's wrong.

Thanks
Roberto

figaro

unread,
Feb 8, 2022, 2:04:26 AM2/8/22
to Trac Users
Thank you for your efforts. Will look into this also over the next few weeks.

-- figaro

Steve Sagodi

unread,
Mar 14, 2022, 11:45:26 AM3/14/22
to Trac Users
Hi we installed on our TRAC instance but none of our existing test cases show up on the Test Manage page just Example Catalog.

Clicking on the Test Stat gives an error
-  Trac detected an internal error:NameError: global name 'env' is not defined

Any suggestions on if we missed a config item ?

Ryan Ollos

unread,
Mar 14, 2022, 11:50:04 AM3/14/22
to Trac Users
On Mon, Mar 14, 2022 at 8:45 AM Steve Sagodi <ssa...@gmail.com> wrote:
Hi we installed on our TRAC instance but none of our existing test cases show up on the Test Manage page just Example Catalog.

Clicking on the Test Stat gives an error
-  Trac detected an internal error:NameError: global name 'env' is not defined

Any suggestions on if we missed a config item ?

Almost certainly that's a coding error. Could you please locate the traceback in the log and post it here?
 

Roberto Longobardi

unread,
Mar 14, 2022, 1:09:29 PM3/14/22
to Trac Users
Unfortunately you are right, there's still some incompatibility with Trac 1.4.x, which I didn't spot because of an incorrect setup of my test environment... I was actually testing against a Trac 1.2.x instead... My bad.

I fixed most of the problems last night and I'm almost ready for a new release. I just want to perform more extensive tests with Trac versions 1.2, 1.3 and 1.4.

A question for Ryan, though: how old Trac versions do you think it still makes sense to support? Will it be ok to stop at 1.2 or you think I should go even backward?

Regards.
Roberto

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+...@googlegroups.com.

RjOllos

unread,
Mar 14, 2022, 1:12:38 PM3/14/22
to Trac Users
On Monday, March 14, 2022 at 10:09:29 AM UTC-7 sec...@gmail.com wrote:
Unfortunately you are right, there's still some incompatibility with Trac 1.4.x, which I didn't spot because of an incorrect setup of my test environment... I was actually testing against a Trac 1.2.x instead... My bad.

I fixed most of the problems last night and I'm almost ready for a new release. I just want to perform more extensive tests with Trac versions 1.2, 1.3 and 1.4.

A question for Ryan, though: how old Trac versions do you think it still makes sense to support? Will it be ok to stop at 1.2 or you think I should go even backward?

Regards.
Roberto

Supporting back to 1.2 is probably fine since the old version works with 1.0. The 1.4 and 1.5 release lines are currently the only that are maintained.

Ryan 

Roberto Longobardi

unread,
Mar 14, 2022, 2:06:58 PM3/14/22
to Trac Users
OK thanks Ryan.

I'm facing some final problems with Genshi templates in Trac 1.4.3.

It looks like Trac is trying to render my templates with Jinja2 instead of Genshi...

Is there anything I should do to force Genshi to render my templates?

Here is the stack trace:

18:47:17 Trac[main] DEBUG: Rendering response with template testmanagerstats.html
18:47:17 Trac[web_ui] DEBUG: TestManagerTemplateProvider init
18:47:17 Trac[wiki] DEBUG: WikiTestManagerInterface init
18:47:17 Trac[workflow] DEBUG: TestManagerWorkflowInterface init
18:47:17 Trac[chrome] ERROR: Jinja2 UndefinedError error while rendering XML/HTML template
Traceback (most recent call last):
  File "/home/roberto/Documenti/build/pve-trac14-vero/lib/python2.7/site-packages/trac/web/chrome.py", line 1706, in _iterable_jinja_content
    for chunk in stream:
  File "/home/roberto/Documenti/build/pve-trac14-vero/lib/python2.7/site-packages/jinja2/environment.py", line 1357, in __next__
    return self._next()
  File "/home/roberto/Documenti/build/pve-trac14-vero/lib/python2.7/site-packages/jinja2/environment.py", line 1334, in _buffered_generator
    c = next(self._gen)
  File "/home/roberto/Documenti/build/pve-trac14-vero/lib/python2.7/site-packages/jinja2/environment.py", line 1125, in generate
    yield self.environment.handle_exception()
  File "/home/roberto/Documenti/build/pve-trac14-vero/lib/python2.7/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/home/roberto/.cache/Python-Eggs/TestManager-1.10.3-py2.7.egg-tmp/testmanager/templates/testmanagerstats.html", line 125, in top-level template code
    <option value="${m['planid']}|${m['catpath']}">${m['name']}</option>
  File "/home/roberto/Documenti/build/pve-trac14-vero/lib/python2.7/site-packages/jinja2/environment.py", line 452, in getitem
    return obj[argument]
UndefinedError: 'm' is undefined


And the relevant template code, where it looks like the "py:for" directive is not understood nor run:

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
i18n:domain="testmanager"
>
<xi:include href="layout.html" />
<xi:include href="macros.html" />

# import 'macros.html' as jmacros with context

[...]
<select id="testplan" name="testplan">
<option value="__all">All Test Plans</option>
<py:for each="m in testplans">
<option value="${m['planid']}|${m['catpath']}">${m['name']}</option>
</py:for>
</select>


And the code I use to render the template:

class TestStatsPlugin(Component):
implements(INavigationContributor, IRequestHandler, ITemplateProvider, IPermissionRequestor)

[...]
def process_request(self, req):
[...]
return 'testmanagerstats.html', data


Any help is appreciated. Thanks.
Roberto



--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+...@googlegroups.com.

RjOllos

unread,
Mar 14, 2022, 2:53:22 PM3/14/22
to Trac Users
You'll need to return:

 return 'testmanagerstats.html', data, None

in order to tell Trac that the template being rendered is a Genshi template. Also, you can't use "import ... jmacros" in a Genshi template, that's Jinja2 syntax.


Ryan

Roberto Longobardi

unread,
Mar 19, 2022, 1:10:37 PM3/19/22
to Trac Users

The previous releases were not compatibile with Trac 1.4 because of a mistake in setting up my test environment.

I've just fixed all incompatibilities with Trac 1.2 and with Trac 1.4 and cleaned up all the releases.

Now you will find that:

  • Releases 1.9.x are compatible with Trac 0.12.x.
  • Releases 1.20.x are compatible with Trac 1.2.x.
  • Releases 2.x are compatible with Trac 1.4.x.

Unfortunately there is currently no release compatible with Trac 1.5, because of the dropped support of Genshi, a technology the plugins are heavily based on.

Please, refer to the releases page for the available downloads: https://github.com/seccanj/testman4trac/releases


Kind regards.

Roberto



--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages