[Twisted-Python] Failing tests in trunk

I branched trunk from the LP repository. Running the tests all together ("trial twisted"), consistently makes me fail the following 12: twisted.conch.test.test_cftp.ListingTests.test_newFile twisted.conch.test.test_cftp.ListingTests.test_newSingleDigitDayOfMonth twisted.conch.test.test_cftp.ListingTests.test_oldFile twisted.conch.test.test_cftp.ListingTests.test_oldSingleDigitDayOfMonth twisted.mail.test.test_imap.NewFetchTestCase.testFetchAll twisted.mail.test.test_imap.NewFetchTestCase.testFetchAllUID twisted.mail.test.test_imap.NewFetchTestCase.testFetchFast twisted.mail.test.test_imap.NewFetchTestCase.testFetchFastUID twisted.mail.test.test_imap.NewFetchTestCase.testFetchFull twisted.mail.test.test_imap.NewFetchTestCase.testFetchFullUID twisted.mail.test.test_imap.NewFetchTestCase.testFetchInternalDate twisted.mail.test.test_imap.NewFetchTestCase.testFetchInternalDateUID However, if I run the tests doing "trial twisted.mail" or "trial twisted.conch", they never fail. I still didn't debug this, but I wanted to see if somebody experienced something similar to this. Regards, -- . Facundo Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/

On 7 Mar, 11:48 pm, facundobatista@gmail.com wrote:
I branched trunk from the LP repository. Running the tests all together ("trial twisted"), consistently makes me fail the following 12:
twisted.conch.test.test_cftp.ListingTests.test_newFile twisted.conch.test.test_cftp.ListingTests.test_newSingleDigitDayOfMonth twisted.conch.test.test_cftp.ListingTests.test_oldFile twisted.conch.test.test_cftp.ListingTests.test_oldSingleDigitDayOfMonth twisted.mail.test.test_imap.NewFetchTestCase.testFetchAll twisted.mail.test.test_imap.NewFetchTestCase.testFetchAllUID twisted.mail.test.test_imap.NewFetchTestCase.testFetchFast twisted.mail.test.test_imap.NewFetchTestCase.testFetchFastUID twisted.mail.test.test_imap.NewFetchTestCase.testFetchFull twisted.mail.test.test_imap.NewFetchTestCase.testFetchFullUID twisted.mail.test.test_imap.NewFetchTestCase.testFetchInternalDate twisted.mail.test.test_imap.NewFetchTestCase.testFetchInternalDateUID
However, if I run the tests doing "trial twisted.mail" or "trial twisted.conch", they never fail.
I still didn't debug this, but I wanted to see if somebody experienced something similar to this.
None of these are known failures: http://buildbot.twistedmatrix.com/boxes-supported Just looking at the list of failing tests, I would make a small bet that the failures are caused by your locale setting somehow. Jean-Paul

On Mon, Mar 7, 2011 at 9:34 PM, <exarkun@twistedmatrix.com> wrote:
None of these are known failures:
http://buildbot.twistedmatrix.com/boxes-supported
Just looking at the list of failing tests, I would make a small bet that the failures are caused by your locale setting somehow.
I thought of that, but why would the test pass when running alone? I'll debug this. -- . Facundo Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/

On 8 March 2011 12:04, Facundo Batista <facundobatista@gmail.com> wrote:
On Mon, Mar 7, 2011 at 9:34 PM, <exarkun@twistedmatrix.com> wrote:
None of these are known failures:
http://buildbot.twistedmatrix.com/boxes-supported
Just looking at the list of failing tests, I would make a small bet that the failures are caused by your locale setting somehow.
I thought of that, but why would the test pass when running alone?
Sometimes a test can leave things running which causes later tests to fail, trial tries to spot this but doesn't always succeed You can try running the tests in a different order, there's a switch to get trial to do that for you, and you can try to isolate which earlier tests make the tests fail and then examine them. Michael

On Tue, Mar 8, 2011 at 7:04 AM, Facundo Batista <facundobatista@gmail.com> wrote:
None of these are known failures:
http://buildbot.twistedmatrix.com/boxes-supported
Just looking at the list of failing tests, I would make a small bet that the failures are caused by your locale setting somehow.
I thought of that, but why would the test pass when running alone?
I'll debug this.
Ok, found it. See one example of the test that failed, twisted.mail.test.test_imap.NewFetchTestCase.testFetchInternalDate: twisted.trial.unittest.FailTest: not equal: a = {0: {'INTERNALDATE': '02-nov-2003 21:25:10 +0000'}, 1: {'INTERNALDATE': '29-dic-2013 11:31:52 -0500'}, 2: {'INTERNALDATE': '10-mar-1992 02:44:30 -0600'}, 3: {'INTERNALDATE': '11-ene-2000 14:40:24 -0800'}} b = {0: {'INTERNALDATE': '02-Nov-2003 21:25:10 +0000'}, 1: {'INTERNALDATE': '29-Dec-2013 11:31:52 -0500'}, 2: {'INTERNALDATE': '10-Mar-1992 02:44:30 -0600'}, 3: {'INTERNALDATE': '11-Jan-2000 14:40:24 -0800'}} See the difference? "nov" instead of "Nov", etc. "dic" instead of "Dec". Yes, in Spanish December is 'diciembre'. So, funny 'locale' issue, confirmed by showing getlocale() in the test... when running the whole suite, the locale is ('es_AR', 'UTF8'), and when running twisted.mail the locale is (None, None). Weird, specially taking into account that 'locale' is not used in the whole twisted project. But I tracked it down. In twisted/manhole/ui/test/test_gtk2manhole.py, gtk is imported, and that changes the locale [0]. So, how this can be fixed? Is ok for the IMAP4Server to spew the message internal date according to the locale in which it's being run? Or it should always format the dates in an specific way, because some definition somewhere? (I don't know much about IMAP) If it's ok for the server to format the dates according to the locale, I should make the test more robust. If not, the server should set the locale to (None, None) for the date formatting, or just set it at __init__ and leave it there, or use other formatting (not time.strftime, I prefer this solution). Ideas? Opinions? Thanks! (BTW, I'm already at PyCon :D ) [0] Which I easily tested in a clean Python interpreter: >>> import locale >>> locale.getlocale() (None, None) >>> import gtk >>> locale.getlocale() ('es_AR', 'UTF8') -- . Facundo Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/

On 10 Mar, 07:39 pm, facundobatista@gmail.com wrote:
On Tue, Mar 8, 2011 at 7:04 AM, Facundo Batista <facundobatista@gmail.com> wrote:
None of these are known failures:
� �http://buildbot.twistedmatrix.com/boxes-supported
Just looking at the list of failing tests, I would make a small bet that the failures are caused by your locale setting somehow.
I thought of that, but why would the test pass when running alone?
I'll debug this.
Ok, found it.
See one example of the test that failed, twisted.mail.test.test_imap.NewFetchTestCase.testFetchInternalDate:
twisted.trial.unittest.FailTest: not equal: a = {0: {'INTERNALDATE': '02-nov-2003 21:25:10 +0000'}, 1: {'INTERNALDATE': '29-dic-2013 11:31:52 -0500'}, 2: {'INTERNALDATE': '10-mar-1992 02:44:30 -0600'}, 3: {'INTERNALDATE': '11-ene-2000 14:40:24 -0800'}} b = {0: {'INTERNALDATE': '02-Nov-2003 21:25:10 +0000'}, 1: {'INTERNALDATE': '29-Dec-2013 11:31:52 -0500'}, 2: {'INTERNALDATE': '10-Mar-1992 02:44:30 -0600'}, 3: {'INTERNALDATE': '11-Jan-2000 14:40:24 -0800'}}
See the difference? "nov" instead of "Nov", etc. "dic" instead of "Dec". Yes, in Spanish December is 'diciembre'.
So, funny 'locale' issue, confirmed by showing getlocale() in the test... when running the whole suite, the locale is ('es_AR', 'UTF8'), and when running twisted.mail the locale is (None, None).
Weird, specially taking into account that 'locale' is not used in the whole twisted project.
But I tracked it down.
In twisted/manhole/ui/test/test_gtk2manhole.py, gtk is imported, and that changes the locale [0].
Aha, nicely done. I figured the locale change would be in Python somewhere, I didn't consider it might be hidden in Gtk.
So, how this can be fixed?
Is ok for the IMAP4Server to spew the message internal date according to the locale in which it's being run? Or it should always format the dates in an specific way, because some definition somewhere? (I don't know much about IMAP)
IMAP specifies the strings in the unit test. So the implementation really needs to change to not depend on the locale.
If it's ok for the server to format the dates according to the locale, I should make the test more robust. If not, the server should set the locale to (None, None) for the date formatting, or just set it at __init__ and leave it there, or use other formatting (not time.strftime, I prefer this solution).
I agree with your preference, switching away from time.strftime is probably the right thing to do. Jean-Paul

On Thu, Mar 10, 2011 at 9:51 PM, <exarkun@twistedmatrix.com> wrote:
__init__ and leave it there, or use other formatting (not time.strftime, I prefer this solution).
I agree with your preference, switching away from time.strftime is probably the right thing to do.
Opened a ticket for this, patch attached: http://twistedmatrix.com/trac/ticket/4937 Regards, -- . Facundo Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/
participants (3)
-
exarkun@twistedmatrix.com
-
Facundo Batista
-
Michael Thompson