#11316 closed defect (fixed)
Test failures in trac.wiki.tests.formatter when executed in isolation — at Version 2
Reported by: | Ryan J Ollos | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.5 |
Component: | wiki system | Version: | |
Severity: | normal | Keywords: | unit tests |
Cc: | Branch: | ||
Release Notes: |
Modified Make file to run |
||
API Changes: | |||
Internal Changes: |
Description
Executing all of the tests in trac.wiki.tests
succeeds,
PYTHONPATH=. python -m trac.wiki.tests.__init__ ................................................................................................................................................................................................................................................................................................................................................................... ---------------------------------------------------------------------- Ran 355 tests in 1.417s OK
However, executing just the tests in trac.wiki.tests.formatter
fails:
PYTHONPATH=. python -m trac.wiki.tests.formatter ...........................................................................................F.F........................................................................................................................................................ ====================================================================== FAIL: test (__main__.WikiTestCase) Test Macro help shortcut (with content) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/user/Workspace/t10834/teo-rjollos.git/trac/wiki/tests/formatter.py", line 222, in test % (msg, self.file, self.line, self.title, formatter.flavor)) AssertionError: ========== expected: ========== <p> </p><div class="trac-macrolist"><h3 id="HelloWorld-macro"><code>[[HelloWorld]]</code></h3><p> A dummy macro used by the unit test. </p> </div><p> </p> ========== actual: ========== <p> </p><div class="trac-macrolist"><h3 id="HelloWorld-macro"><code>[[HelloWorld]]</code></h3><p> A dummy macro used by the unit test. </p> <h3 id="HelloWorld-macro"><code>[[HelloWorld]]</code></h3><p> A dummy macro used by the unit test. </p> </div><p> </p> ========== wiki: ========== u' [[HelloWorld?(hej hopp)]] ' ========== diff: ========== --- expected +++ actual @@ -1,5 +1,8 @@ <p> </p><div class="trac-macrolist"><h3 id="HelloWorld-macro"><code>[[HelloWorld]]</code></h3><p> +A dummy macro used by the unit test. +</p> +<h3 id="HelloWorld-macro"><code>[[HelloWorld]]</code></h3><p> A dummy macro used by the unit test. </p> </div><p> /home/user/Workspace/t10834/teo-rjollos.git/trac/wiki/tests/wiki-tests.txt:1006: "Macro help shortcut (with content)" (default flavor) ====================================================================== FAIL: test (__main__.WikiTestCase) Test Macro help shortcut (no content) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/user/Workspace/t10834/teo-rjollos.git/trac/wiki/tests/formatter.py", line 222, in test % (msg, self.file, self.line, self.title, formatter.flavor)) AssertionError: ========== expected: ========== <p> </p><div class="trac-macrolist"><h3 id="HelloWorld-macro"><code>[[HelloWorld]]</code></h3><p> A dummy macro used by the unit test. </p> </div><p> </p> ========== actual: ========== <p> </p><div class="trac-macrolist"><h3 id="HelloWorld-macro"><code>[[HelloWorld]]</code></h3><p> A dummy macro used by the unit test. </p> <h3 id="HelloWorld-macro"><code>[[HelloWorld]]</code></h3><p> A dummy macro used by the unit test. </p> </div><p> </p> ========== wiki: ========== u' [[HelloWorld?]] ' ========== diff: ========== --- expected +++ actual @@ -1,5 +1,8 @@ <p> </p><div class="trac-macrolist"><h3 id="HelloWorld-macro"><code>[[HelloWorld]]</code></h3><p> +A dummy macro used by the unit test. +</p> +<h3 id="HelloWorld-macro"><code>[[HelloWorld]]</code></h3><p> A dummy macro used by the unit test. </p> </div><p> /home/user/Workspace/t10834/teo-rjollos.git/trac/wiki/tests/wiki-tests.txt:1017: "Macro help shortcut (no content)" (default flavor) ---------------------------------------------------------------------- Ran 246 tests in 0.710s FAILED (failures=2)
Change History (2)
comment:1 by , 10 years ago
comment:2 by , 9 years ago
Milestone: | next-stable-1.0.x → 1.0.5 |
---|---|
Release Notes: | modified (diff) |
Resolution: | → fixed |
Status: | new → closed |
Fixed in [13851]. Merged to trunk in [13852]. See comment:21:ticket:11437.
Note:
See TracTickets
for help on using tickets.
The issue seems to be due to some module/import behaviour, possibly related to the explanation in comment:7:ticket:11312, but I don't understand it well enough to provide a fix yet.
My observation is that the
HelloWorldMacro
is being discovered twice at branches/1.0-stable/trac/wiki/macros.py@12046:689#L669:<__main__.HelloWorldMacro object at 0x24afd10>
<trac.wiki.tests.formatter.HelloWorldMacro object at 0x24afad0>
The test does not fail when running,
PYTHONPATH=. python -m trac/wiki/tests/formatter.py
, but in that case the<trac.wiki.tests.formatter.HelloWorldMacro object at 0x24afad0>
is not returned byformatter.wiki.macro_providers
. When running the tests asPYTHONPATH=. python -m trac.wiki.tests.formatter
, the macro is discovered in two objects.