Debian Bug report logs - #732679
test_nodes.ElementTests.test_empty fails for py3: "•" != "\\u2022"

version graph

Package: python-docutils; Maintainer for python-docutils is Debian Python Modules Team <python-modules-team@lists.alioth.debian.org>; Source for python-docutils is src:python-docutils.

Reported by: Martin Pitt <mpitt@debian.org>

Date: Fri, 20 Dec 2013 09:18:02 UTC

Severity: serious

Tags: patch

Found in version python-docutils/0.11-2

Fixed in version python-docutils/0.11-3

Done: Michael Schutte <michi@debian.org>

Bug is archived. No further changes may be made.

Forwarded to https://sourceforge.net/p/docutils/patches/115/

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian Python Modules Team <python-modules-team@lists.alioth.debian.org>:
Bug#732679; Package python-docutils. (Fri, 20 Dec 2013 09:18:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Martin Pitt <mpitt@debian.org>:
New Bug report received and forwarded. Copy sent to Debian Python Modules Team <python-modules-team@lists.alioth.debian.org>. (Fri, 20 Dec 2013 09:18:06 GMT) Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Martin Pitt <mpitt@debian.org>
To: Debian BTS Submit <submit@bugs.debian.org>
Subject: test_nodes.ElementTests.test_empty fails for py3: "•" != "\\u2022"
Date: Fri, 20 Dec 2013 10:14:15 +0100
Package: python-docutils
Version: 0.11-2

Hello,

Since recently [1], python-docutils' python3 test fail [2], most
likely since the update of python3 from 3.3.2 to 3.3.3:

======================================================================
FAIL: test_empty (__main__.ElementTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test3/test_nodes.py", line 95, in test_empty
AssertionError: '<Element mark="•"/>' != '<Element mark="\\u2022"/>'
- <Element mark="•"/>
?                ^
+ <Element mark="\u2022"/>
?                ^^^^^^

This is with LANG=en_US.UTF-8 or C.UTF-8. With the C locale (ASCII
only), I get

  AssertionError: '<Element mark="\u2022"/>' != '<Element mark="\\u2022"/>'

instead.

The quickest way to reproduce this is

$ python3 setup.py build --build-lib=build/py3/
$ python3 test3/test_nodes.py ElementTests.test_empty

(just tested in a clean and up to date sid schroot.)

The most likely cause is the 2to3 conversion of the test. The original code
alreaydy differs between 2 and 3:

        if sys.version_info < (3,):
            self.assertEqual(str(element), '<Element mark="\\u2022"/>')
        else:
            self.assertEqual(str(element), '<Element mark="\u2022"/>')


But in test3/, 2to3 mangles this to

        if sys.version_info < (3,):
            self.assertEqual(str(element), '<Element mark="\\u2022"/>')
        else:
            self.assertEqual(str(element), '<Element mark="\\u2022"/>')

I. e. exactly the same for both python versions. If I un-break the
additional \, then \u2022 is in fact the right representation of •,
and the test works again.

I'm not sure whether this is an overzealous 2to3 conversion, or
whether 2to3 is actually right.

FTR, tests with python2 work with both C and C.UTF-8.

Thanks for considering,

Martin

[1] https://jenkins.qa.ubuntu.com/job/trusty-adt-python-docutils/?
[2] https://jenkins.qa.ubuntu.com/job/trusty-adt-python-docutils/4/ARCH=i386,label=adt/artifact/results/dsc0t-python3-docutils-stdout
-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)



Information forwarded to debian-bugs-dist@lists.debian.org, Debian Python Modules Team <python-modules-team@lists.alioth.debian.org>:
Bug#732679; Package python-docutils. (Fri, 20 Dec 2013 10:03:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Martin Pitt <martin.pitt@ubuntu.com>:
Extra info received and forwarded to list. Copy sent to Debian Python Modules Team <python-modules-team@lists.alioth.debian.org>. (Fri, 20 Dec 2013 10:03:05 GMT) Full text and rfc822 format available.

Message #10 received at 732679@bugs.debian.org (full text, mbox):

From: Martin Pitt <martin.pitt@ubuntu.com>
To: 732679@bugs.debian.org
Subject: Re: Bug#732679: test_nodes.ElementTests.test_empty fails for py3: "•" != "\\u2022"
Date: Fri, 20 Dec 2013 11:00:56 +0100
[Message part 1 (text/plain, inline)]
tag 732679 patch
user ubuntu-devel@lists.ubuntu.com
usertags 732679 origin-ubuntu ubuntu-patch trusty
thanks

I uploaded this diff to Ubuntu which just built (i. e. tests run
during package build), and I locally tested it with autopkgtest and in
sid.

Thanks for considering,

Martin
-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
[python-docutils.py3.3.3.debdiff (text/plain, attachment)]

Added tag(s) patch. Request was from Martin Pitt <martin.pitt@ubuntu.com> to control@bugs.debian.org. (Fri, 20 Dec 2013 10:03:08 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Python Modules Team <python-modules-team@lists.alioth.debian.org>:
Bug#732679; Package python-docutils. (Fri, 20 Dec 2013 11:09:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Martin Pitt <mpitt@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian Python Modules Team <python-modules-team@lists.alioth.debian.org>. (Fri, 20 Dec 2013 11:09:04 GMT) Full text and rfc822 format available.

Message #17 received at 732679@bugs.debian.org (full text, mbox):

From: Martin Pitt <mpitt@debian.org>
To: 732679@bugs.debian.org
Subject: Re: Bug#732679: test_nodes.ElementTests.test_empty fails for py3: "•" != "\\u2022"
Date: Fri, 20 Dec 2013 12:06:03 +0100
Hey Jakub,

Jakub Wilk [2013-12-20 10:36 +0100]:
> The last line should have probably been:
> 
> self.assertEqual(str(element), u'<Element mark="\u2022"/>')
> [...]
> ...then it would be correctly converted to:
> 
> self.assertEqual(str(element), '<Element mark="\u2022"/>')

Ah, that's even more elegant indeed.

> In the past it worked only by accident, due to a bug:
> http://bugs.python.org/issue18037

Thanks for pointing out the root cause!

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)



Information forwarded to debian-bugs-dist@lists.debian.org, Debian Python Modules Team <python-modules-team@lists.alioth.debian.org>:
Bug#732679; Package python-docutils. (Fri, 20 Dec 2013 11:12:04 GMT) Full text and rfc822 format available.

Message #20 received at 732679@bugs.debian.org (full text, mbox):

From: Jakub Wilk <jwilk@debian.org>
To: 732679@bugs.debian.org
Cc: Martin Pitt <mpitt@debian.org>
Subject: Re: Bug#732679: test_nodes.ElementTests.test_empty fails for py3: "•" != "\\u2022"
Date: Fri, 20 Dec 2013 10:36:56 +0100
Control: severity -1 serious

The bug makes the package FTBFS, so I bumped severity.

>The most likely cause is the 2to3 conversion of the test. The original code
>alreaydy differs between 2 and 3:
>
>        if sys.version_info < (3,):
>            self.assertEqual(str(element), '<Element mark="\\u2022"/>')
>        else:
>            self.assertEqual(str(element), '<Element mark="\u2022"/>')

The last line should have probably been:

self.assertEqual(str(element), u'<Element mark="\u2022"/>')

>But in test3/, 2to3 mangles this to
>
>        if sys.version_info < (3,):
>            self.assertEqual(str(element), '<Element mark="\\u2022"/>')
>        else:
>            self.assertEqual(str(element), '<Element mark="\\u2022"/>')

...then it would be correctly converted to:

self.assertEqual(str(element), '<Element mark="\u2022"/>')

In the past it worked only by accident, due to a bug:
http://bugs.python.org/issue18037

-- 
Jakub Wilk



Severity set to 'serious' from 'normal' Request was from Jakub Wilk <jwilk@debian.org> to 732679-submit@bugs.debian.org. (Fri, 20 Dec 2013 11:12:04 GMT) Full text and rfc822 format available.

Set Bug forwarded-to-address to 'https://sourceforge.net/p/docutils/patches/115/'. Request was from Michael Schutte <michi@debian.org> to control@bugs.debian.org. (Sat, 21 Dec 2013 16:27:11 GMT) Full text and rfc822 format available.

Added tag(s) pending. Request was from michi@users.alioth.debian.org to control@bugs.debian.org. (Sat, 21 Dec 2013 16:33:09 GMT) Full text and rfc822 format available.

Reply sent to Michael Schutte <michi@debian.org>:
You have taken responsibility. (Sat, 21 Dec 2013 17:36:17 GMT) Full text and rfc822 format available.

Notification sent to Martin Pitt <mpitt@debian.org>:
Bug acknowledged by developer. (Sat, 21 Dec 2013 17:36:17 GMT) Full text and rfc822 format available.

Message #31 received at 732679-close@bugs.debian.org (full text, mbox):

From: Michael Schutte <michi@debian.org>
To: 732679-close@bugs.debian.org
Subject: Bug#732679: fixed in python-docutils 0.11-3
Date: Sat, 21 Dec 2013 17:33:40 +0000
Source: python-docutils
Source-Version: 0.11-3

We believe that the bug you reported is fixed in the latest version of
python-docutils, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 732679@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Michael Schutte <michi@debian.org> (supplier of updated python-docutils package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Sat, 21 Dec 2013 18:19:15 +0100
Source: python-docutils
Binary: python-docutils python3-docutils docutils-common docutils-doc
Architecture: source all
Version: 0.11-3
Distribution: unstable
Urgency: low
Maintainer: Debian Python Modules Team <python-modules-team@lists.alioth.debian.org>
Changed-By: Michael Schutte <michi@debian.org>
Description: 
 docutils-common - text processing system for reStructuredText - common data
 docutils-doc - text processing system for reStructuredText - documentation
 python-docutils - text processing system for reStructuredText (implemented in Pytho
 python3-docutils - text processing system for reStructuredText (implemented in Pytho
Closes: 732679
Changes: 
 python-docutils (0.11-3) unstable; urgency=low
 .
   [ Jakub Wilk ]
   * Remove myself from Uploaders.
 .
   [ Dmitry Shachnev ]
   * Fix package names in Recommends: python(3)-imaging → python(3)-pil.
 .
   [ Michael Schutte ]
   * New patch test_nodes-2to3.diff: Do not rely on a bug in 2to3 string
     literal conversion in test_nodes.ElementTests.test_empty, closes: #732679.
     Thanks to Martin Pitt and Jakub Wilk for investigating.
   * Increase Standards-Version to 3.9.5; no changes required.
Checksums-Sha1: 
 70c4c416f6da3dbac7661b666a818722d99a589e 2006 python-docutils_0.11-3.dsc
 4218b570275696a1a6355cf125742344b26cbc51 37163 python-docutils_0.11-3.debian.tar.gz
 246a43ef75ae2e868413992dd35af57feffa8c2b 362402 python-docutils_0.11-3_all.deb
 1e05df9109403511936c8b98231dd97449b5e1ef 359122 python3-docutils_0.11-3_all.deb
 7739b8551860f70cc6235744c76b5cb947e30ca4 185784 docutils-common_0.11-3_all.deb
 63e03d1e4493472d4cc570c5bb5a8b0bf7458c65 897826 docutils-doc_0.11-3_all.deb
Checksums-Sha256: 
 99df4fa7261a8920b33eca11166a5487fc947c97c86c291d192250e0cc695239 2006 python-docutils_0.11-3.dsc
 a6aaaadc3f9108181cefd4919377489389fad7c0bec6d1887d1b8a5e3f21d414 37163 python-docutils_0.11-3.debian.tar.gz
 ad55fa857ee62b0e973dfc298a40c9aad146010b127d10c75834f9385a2f6357 362402 python-docutils_0.11-3_all.deb
 463056564374fd85fd8f2be1204b5af8d2097c14c365ce91d435e131828bf706 359122 python3-docutils_0.11-3_all.deb
 9fbd1c326d5e65efd67039fd5477198465676eb5745252b5445bf2cff7783b6f 185784 docutils-common_0.11-3_all.deb
 72bc3441f8c72a66e2efdc180085d68611d61fa2e8351c40b0562a8c38b55637 897826 docutils-doc_0.11-3_all.deb
Files: 
 7716093111b3b02c1c448691d9a95a7b 2006 python optional python-docutils_0.11-3.dsc
 3b818fbb164fb93db41ccea16de04798 37163 python optional python-docutils_0.11-3.debian.tar.gz
 053ece6321e5d6d0bd42152ca0903691 362402 python optional python-docutils_0.11-3_all.deb
 176ff687d57e2c09f871c5f64b13d6a4 359122 python optional python3-docutils_0.11-3_all.deb
 5550437eb34e00ecdb49ebd31a19e0a1 185784 python optional docutils-common_0.11-3_all.deb
 19732522e44e06e316b42689afe700d2 897826 doc optional docutils-doc_0.11-3_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (GNU/Linux)

iQEcBAEBCAAGBQJStc90AAoJEPPkEi8djCYa80MH/0zJBs8Y1MiDQ44fThYSY3mg
hG5NvT/O/Z4MS5xGZmS9KSVkMRXuXFhrrSayu82E0uX1HPu1uLJ+g6xTiwHTbWfs
LvEifLHNtkHl2MKLBee8hTZvEJ3wHEOLD2fTazqlE5XJWzJa6z5FHzBTFcopU9dr
Xjj8WnEKJsnKt3A3NLjDWNuO7vtB18yHttYy/+irtVKICl/l5XPauIv9UNT0IyB8
VqtXx3rlyJeV8TbZyu1wNoFWy6s6V+M3svI72Jo/m2rrj5UPXOfbgCp1o3MAQ2fE
Wc+5le3NhFqm2GvcJ0CP7rvUMYTKH+9C7+YQfTTnI/3WJMaSIfrsammkLKSjZCI=
=fXCs
-----END PGP SIGNATURE-----




Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Sat, 25 Jan 2014 07:38:46 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sat Apr 19 10:03:23 2014; Machine Name: buxtehude.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.