Control: tags -1 patch

The failing tests are:

======================================================================
FAIL: blockdiag.tests.test_generate_diagram.test_generate(<function main at 0x7f79a5528f28>, 'svg', '/tmp/buildd/blockdiag-1.5.3+dfsg/.pybuild/pythonX.Y_3.5/build/src/blockdiag/tests/diagrams/multiple_nodes_definition.diag', ['-f', '/usr/share/fonts/truetype/vlgothic/VL-Gothic-Regular.ttf'])
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
File "/tmp/buildd/blockdiag-1.5.3+dfsg/.pybuild/pythonX.Y_3.5/build/src/blockdiag/tests/utils.py", line 68, in wrap
    raise AssertionError('Caught error')
AssertionError: Caught error
-------------------- >> begin captured stdout << ---------------------
---[ stderr ] ---
Exception ignored in: <bound method Resource.__del__ of <wand.image.Image: (empty)>>
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/wand/resource.py", line 232, in __del__
    self.destroy()
File "/usr/lib/python3/dist-packages/wand/image.py", line 2767, in destroy
    for i in range(0, len(self.sequence)):
TypeError: object of type 'NoneType' has no len()


--------------------- >> end captured stdout << ----------------------

======================================================================
FAIL: blockdiag.tests.test_generate_diagram.svg_includes_source_code_tag_test
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
File "/tmp/buildd/blockdiag-1.5.3+dfsg/.pybuild/pythonX.Y_3.5/build/src/blockdiag/tests/utils.py", line 68, in wrap
    raise AssertionError('Caught error')
AssertionError: Caught error
-------------------- >> begin captured stdout << ---------------------
---[ stderr ] ---
Exception ignored in: <bound method Resource.__del__ of <wand.image.Image: (empty)>>
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/wand/resource.py", line 232, in __del__
    self.destroy()
File "/usr/lib/python3/dist-packages/wand/image.py", line 2767, in destroy
    for i in range(0, len(self.sequence)):
TypeError: object of type 'NoneType' has no len()


--------------------- >> end captured stdout << ----------------------

----------------------------------------------------------------------
Ran 710 tests in 2.926s

FAILED (SKIP=351, failures=2)

The reason they fail now and not before is probably the new version of wand: it added an Image.destroy() (https://sources.debian.net/src/wand/0.4.4-1/wand/image.py/#L2760) that iterates over self.sequence (the frames of an animation) to free their memory. This throws an exception on single images (where self.sequence=None), but as this is called from __del__, this exception is warned about then ignored (https://docs.python.org/3/reference/datamodel.html#object.__del__), and hence is not an error in normal use. (As it does pointlessly scare the user, I'd consider it a wand bug, but not an RC one.)

However, blockdiag tests that use capture_stderr fail on any output containing "Traceback", including this warning message.

This can be worked around in blockdiag or fixed at source in wand; I attach patches for both options (the blockdiag one builds, but that's all the testing I've done; the wand one hasn't been tested at all).

(See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=840823#19 , particularly if you choose the wand option)
Description: Fix test failure with wand 0.4.1+
 
wand 0.4.1 added an Image.destroy()
(https://sources.debian.net/src/wand/0.4.4-1/wand/image.py/#L2760) that
iterates over self.sequence (the frames of an animation) to free their
memory; this throws an exception on single images (where
self.sequence=None), but as this is called from __del__, this
exception is warned about then ignored
(https://docs.python.org/3/reference/datamodel.html#object.__del__),
and hence is not an error in normal use.

However, blockdiag tests that use capture_stderr fail on any output
containing "Traceback", including this warning message.

This patch ignores this message to allow blockdiag to build.

Author: Rebecca Palmer <rebecca_pal...@zoho.com>
Bug-Debian: https://bugs.debian.org/848748
Forwarded: no

--- blockdiag-1.5.3+dfsg.orig/src/blockdiag/tests/utils.py
+++ blockdiag-1.5.3+dfsg/src/blockdiag/tests/utils.py
@@ -64,7 +64,14 @@ def capture_stderr(func):
 
             func(*args, **kwargs)
 
-            if re.search('(ERROR|Traceback)', sys.stderr.getvalue()):
+            filtered_stderr=re.sub(r"""Exception ignored in: <bound method Resource\.__del__ of <wand\.image\.Image: \(empty\)>>
+Traceback \(most recent call last\):
+  File "/usr/lib/python3/dist-packages/wand/resource\.py", line [0-9]+, in __del__
+    self\.destroy\(\)
+  File "/usr/lib/python3/dist-packages/wand/image\.py", line [0-9]+, in destroy
+    for i in range\(0, len\(self\.sequence\)\):
+TypeError: object of type 'NoneType' has no len\(\)""","",sys.stderr.getvalue())#this is the expected result of freeing a single image (as opposed to an animation) in wand 0.4, not a blockdiag bug - #848748
+            if re.search('(ERROR|Traceback)', filtered_stderr):
                 raise AssertionError('Caught error')
         finally:
             if sys.stderr.getvalue():
Description: Fix "Exception ignored" warning on destroying a single image

Image.destroy() iterates over self.sequence (the frames of an
animation) to free their memory; the exception this throws on single
images (where self.sequence=None) is suppressed because this is called
from __del__
(https://docs.python.org/3/reference/datamodel.html#object.__del__),
but in Python 3.5 this prints a warning, which needlessly scares
the user and may fail tests (e.g. blockdiag).

Author: Rebecca Palmer <rebecca_pal...@zoho.com>
Bug-Debian: https://bugs.debian.org/848748
Forwarded: no

--- wand-0.4.4.orig/wand/image.py
+++ wand-0.4.4/wand/image.py
@@ -2764,8 +2764,9 @@ class Image(BaseImage):
         manager.
 
         """
-        for i in range(0, len(self.sequence)):
-            self.sequence.pop()
+        if self.sequence is not None:
+            for i in range(0, len(self.sequence)):
+                self.sequence.pop()
         super(Image, self).destroy()
 
     def read(self, file=None, filename=None, blob=None, resolution=None):

Reply via email to