[Baypiggies] Unusual unit test behavior on OSX

Guido van Rossum guido at python.org
Wed Oct 29 06:40:59 CET 2014


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
> <javascript:_e(%7B%7D,'cvml','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
>> <javascript:_e(%7B%7D,'cvml','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
>> <javascript:_e(%7B%7D,'cvml','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/6637e9ee/attachment-0001.html>


More information about the Baypiggies mailing list