Patchwork D2537: tests: make get-with-headers flush after print() calls

login
register
mail settings
Submitter phabricator
Date March 2, 2018, 2:50 p.m.
Message ID <differential-rev-PHID-DREV-gwfblbw4ggac7prwwrd6-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/28663/
State Superseded
Headers show

Comments

phabricator - March 2, 2018, 2:50 p.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This avoids some output buffering problems on Python 3.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2537

AFFECTED FILES
  tests/get-with-headers.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel
phabricator - March 2, 2018, 4:05 p.m.
yuja requested changes to this revision.
yuja added a comment.
This revision now requires changes to proceed.


  Appears that this disclosed some weird issue:
  
    --- tests/test-hgweb-commands.t
    +++ tests/test-hgweb-commands.t.err
    @@ -2116,7 +2116,10 @@
       $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=capabilities' | dd ibs=75 count=1 2> /dev/null; echo
       200 Script output follows
    
    -  lookup changegroupsubset branchmap pushkey known
    +  close failed in file object destructor:
    +  sys.excepthook is missing
    +  lost sys.stderr
    +

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2537

To: durin42, #hg-reviewers, pulkit, yuja
Cc: yuja, mercurial-devel

Patch

diff --git a/tests/get-with-headers.py b/tests/get-with-headers.py
--- a/tests/get-with-headers.py
+++ b/tests/get-with-headers.py
@@ -71,6 +71,7 @@ 
             print("%s: %s" % (h, response.getheader(h)))
     if not headeronly:
         print()
+        sys.stdout.flush()
         data = response.read()
 
         if args.bodyfile: