Edgewall Software

Opened 9 years ago

Last modified 8 years ago

#12233 closed enhancement

Make formatter.suite available to plugins — at Version 8

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.2
Component: wiki system Version:
Severity: normal Keywords: tests
Cc: Branch:
Release Notes:

Added function wikisyntax_test_suite in trac.wiki.test, which plugins can use to create wiki syntax tests.

API Changes:
Internal Changes:

Description

formatter.suite is useful for writing macro test cases, as seen in macros.py. However, from trac.wiki.tests import formatter fails in a plugin when the Trac is not installed in develop (editable) mode.

Change History (9)

comment:1 by Ryan J Ollos, 8 years ago

Edit: Created #12487 for proposed changes.

Last edited 8 years ago by Ryan J Ollos (previous) (diff)

comment:2 by Ryan J Ollos, 8 years ago

Component: generalwiki system
Keywords: tests added
Milestone: next-major-releases1.2

The only way I see to solve this is to either add trac.wiki.tests.formatter directly to the distributed package, or move the code in that file. I considered moving to trac.test, but maybe it would make sense to move to trac.wiki.test: log:rjollos.git:t12233_formatter_test_suite.

comment:3 by Jun Omae, 8 years ago

Why HelloWorldMacro is moved to trac.wiki.test package? I think WikiTestCase, subclasses of the WikiTestCase and wikisyntax_test_suite() only should be moved.

comment:4 by Ryan J Ollos, 8 years ago

WikiTestCase uses HelloWorldMacro to create an environment: trunk/trac/wiki/tests/formatter.py@14791:161-164#L143.

comment:5 by Jun Omae, 8 years ago

I think we should allow to specify components to enable for WikiTestCase and wikisyntax_test_suite. Otherwise, it wouldn't be useful to test for plugins.

comment:6 by Ryan J Ollos, 8 years ago

Owner: set to Ryan J Ollos
Status: newassigned

comment:7 by Ryan J Ollos, 8 years ago

I found we can use Environment.enable_component to enable components in the setup function that is passed to trac.wiki.test.wikisyntax_test_suite. This hadn't worked for me in the past, but the problem was that I specified a component rule rather than a module name (e.g. tractags.* rather than tractags).

Proposed changes in log:rjollos.git:t12233_formatter_test_suite.2. See th:#12788 for a patch that uses trac.wiki.test.wikisyntax_test_suite in the TagsPlugin codebase.

comment:8 by Ryan J Ollos, 8 years ago

Release Notes: modified (diff)

by Jun Omae, 8 years ago

Attachment: t12233-add-env-kwargs.diff added
Note: See TracTickets for help on using tickets.