doctests failing on Centos 6 due to "unprintable" error objects

Bug #826861 reported by Stephen A. Goss
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Mailman
Incomplete
High
Unassigned

Bug Description

On Centos 6 (64 bit), the following tests fail due to what looks like some kind of Python object printing quirk with the version that ships with RHEL 6 and derivatives:
    src/mailman/model/docs/membership.txt
    src/mailman/model/docs/users.txt

The errors all look like this:

File "/home/sgoss/mailman_clone/src/mailman/model/docs/membership.txt", line 296, in membership.txt
Failed example:
    gwen_member.address = new_address
Differences (ndiff with -expected +actual):
      Traceback (most recent call last):
    - ...
    - UnverifiedAddressError: <email address hidden>
    + File "/usr/lib64/python2.6/doctest.py", line 1248, in __run
    + compileflags, 1) in test.globs
    + File "<doctest membership.txt[68]>", line 1, in <module>
    + gwen_member.address = new_address
    + File "/home/sgoss/mailman_clone/src/mailman/model/member.py", line 116, in address
    + raise UnverifiedAddressError(new_address)
    + UnverifiedAddressError: <unprintable UnverifiedAddressError object>

The system reports Python version 2.6.5.

This error does not seem to occur with Python 2.7 on Ubuntu 11.04.

One possibility is that for some reason when it comes to printing out those error objects, Python doesn't have a default encoding scheme for representing the embedded unicode strings in that particular context (email address in the above example).

Tags: mailman3
Revision history for this message
Stephen A. Goss (postfuturist) wrote :

A quick fix to this is to convert the unicode addresses to string objects in the __str__ methods for those Error classes. The attached patch does just that, causing the tests to pass unchanged on Centos 6.

Revision history for this message
Barry Warsaw (barry) wrote :

I can't reproduce this with Python 2.6.7 on Ubuntu 11.10 64bit either. I'll have to bring up CentOS in a VM, but it would be interesting to know whether 2.6.7 possibly has a related fix, or Ubuntu, or something about the way CentOS builds Python. What's odd here is that there shouldn't be any non-ascii unicodes in the printed representation. Hmm...

Revision history for this message
Stephen A. Goss (postfuturist) wrote :

Since recent code changes another test is failing in this way on Centos 6:

src/mailman/model/docs/registration.txt

File "/home/sgoss/mailman_clone/src/mailman/model/docs/registration.txt", line 61, in registration.txt
Failed example:
    registrar.register(mlist, '\<email address hidden>')
Differences (ndiff with -expected +actual):
      Traceback (most recent call last):
    - ...
    - InvalidEmailAddressError: \<email address hidden>
    + File "/usr/lib64/python2.6/doctest.py", line 1248, in __run
    + compileflags, 1) in test.globs
    + File "<doctest registration.txt[11]>", line 1, in <module>
    + registrar.register(mlist, '\<email address hidden>')
    + File "/home/sgoss/mailman_clone/src/mailman/app/registrar.py", line 60, in register
    + getUtility(IEmailValidator).validate(email)
    + File "/home/sgoss/mailman_clone/src/mailman/email/validate.py", line 69, in validate
    + raise InvalidEmailAddressError(email)
    + InvalidEmailAddressError: <unprintable InvalidEmailAddressError object>

Barry Warsaw (barry)
Changed in mailman:
status: New → Triaged
importance: Undecided → High
Revision history for this message
Barry Warsaw (barry) wrote :

I finally managed to get a Centos 6 VM up and running. All tests pass for me without error. Does this still happen for you with bzr head? Note that I'm running in an en_US.utf8 locale - what about you? Maybe there are problems in other locales?

Changed in mailman:
status: Triaged → Invalid
status: Invalid → Incomplete
Revision history for this message
Abhilash Raj (raj-abhilash1) wrote :

This bug has been moved to the new gitlab repo here: https://gitlab.com/maxking/mailman/issues/6

Revision history for this message
Abhilash Raj (raj-abhilash1) wrote :

Please ignore the above comment, the bug has been moved here: https://gitlab.com/mailman/mailman/issues/6

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.