[Baypiggies] Unusual unit test behavior on OSX

Tony Cappellini cappy2112 at gmail.com
Wed Oct 29 06:48:49 CET 2014


Thanks for pointing that out Guido.

>>Where did you pick up that habit?

>From maintaining code (non-Python) that doesn't always print a trailing \n.
We use several proprietary scripting languages where I work, and they all
use different conventions.
Some of my work habits follow me home, and creep into my personal projects.



On Tue, Oct 28, 2014 at 10:40 PM, Guido van Rossum <guido at python.org> wrote:

> Hi Tony,
>
> It's because of the trailing comma in your  print statement. Stdout only
> gets flushed when a \n is written. You probably didn't notice this because
> the print statement *starts* with \n. (Where did you pick up that habit?)
>
> --Guido
>
>
> On Tuesday, October 28, 2014, Tony Cappellini <cappy2112 at gmail.com> wrote:
>
>> Thanks Nanshu.
>>
>> That does make the unit test output look like what I would expect.
>>
>> Record #  1, ;180000FFEEDDCCBBAA0099887766554433221122334455667788990AFC
>> Record #  2, ;180218778E4017203C02A20C8E4217A2318E4017203C02A20E8E420717
>> Record #  3, ;180230EA65ED65EE85E9A204B5E995EACA10F938E999B0E8A5EB290FE8.
>> ----------------------------------------------------------------------
>> Ran 1 test in 0.000s
>>
>> OK
>>
>> I've never had any issues like this with unit test before.
>>
>>
>> On Tue, Oct 28, 2014 at 10:02 PM, Nanshu Chen <nanshu at gmail.com> wrote:
>>
>>> Add sys.stdout.flush() after your print, or replace print with
>>> sys.stderr.write.
>>>
>>>
>>>
>>> On Tue, Oct 28, 2014 at 9:34 PM, Tony Cappellini <cappy2112 at gmail.com>
>>> wrote:
>>> >  Hello Everyone,
>>> >
>>> >
>>> > When I ran this unit test that I wrote
>>> >
>>> > http://pastebin.com/YxZH4RHR
>>> >
>>> > I'm seeing some very unusual output that I can't explain.
>>> >
>>> > This is the output.
>>> >
>>> > Record #  1,
>>> ;180000FFEEDDCCBBAA0099887766554433221122334455667788990AFC
>>> > Record #  2,
>>> ;180218778E4017203C02A20C8E4217A2318E4017203C02A20E8E420717
>>> > .
>>> > ----------------------------------------------------------------------
>>> > Ran 1 test in 0.000s
>>> >
>>> > OK
>>> > Record #  3,
>>> ;180230EA65ED65EE85E9A204B5E995EACA10F938E999B0E8A5EB290FE8
>>> >
>>> >
>>> > I only have one test method defined at the moment.
>>> > It looks like two iterations are occurring as expected,
>>> > and the last occurs much later.
>>> >
>>> > Why do all three iterations not happen before the unit test framework
>>> > displays "Ran 1 test in 0.000s" ?
>>> >
>>> > Thanks
>>> >
>>> >
>>> > _______________________________________________
>>> > Baypiggies mailing list
>>> > Baypiggies at python.org
>>> > To change your subscription options or unsubscribe:
>>> > https://mail.python.org/mailman/listinfo/baypiggies
>>>
>>
>>
>
> --
> --Guido van Rossum (on iPad)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20141028/8b1bae0e/attachment.html>


More information about the Baypiggies mailing list