Patchwork D3283: py3: suppress the return value of open() in tests/test-subrepo-missing.t

login
register
mail settings
Submitter phabricator
Date April 12, 2018, 12:07 p.m.
Message ID <differential-rev-PHID-DREV-73s6yhxeab735qqcieml-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/30782/
State Superseded
Headers show

Comments

phabricator - April 12, 2018, 12:07 p.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  open() on Python 3 returns a value whereas does not return anything on Python 2.
  So we need to supress the value.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-subrepo-missing.t

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel
phabricator - April 12, 2018, 3:06 p.m.
indygreg accepted this revision.
indygreg added a comment.
This revision is now accepted and ready to land.


  Nit: (I've seen a few commit messages with this mistake.) The thing whose return is being suppressed is `.write()` not `open()`.

REPOSITORY
  rHG Mercurial

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

To: pulkit, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel
phabricator - April 12, 2018, 3:08 p.m.
pulkit added a comment.


  In https://phab.mercurial-scm.org/D3283#52480, @indygreg wrote:
  
  > Nit: (I've seen a few commit messages with this mistake.) The thing whose return is being suppressed is `.write()` not `open()`.
  
  
  If you can fix the commit message on flight, please do. I will take care of this next time.

REPOSITORY
  rHG Mercurial

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

To: pulkit, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel

Patch

diff --git a/tests/test-subrepo-missing.t b/tests/test-subrepo-missing.t
--- a/tests/test-subrepo-missing.t
+++ b/tests/test-subrepo-missing.t
@@ -14,15 +14,15 @@ 
 
 ignore blanklines in .hgsubstate
 
-  >>> open('.hgsubstate', 'wb').write(b'\n\n   \t \n   \n')
+  >>> open('.hgsubstate', 'wb').write(b'\n\n   \t \n   \n') and None
   $ hg st --subrepos
   M .hgsubstate
   $ hg revert -qC .hgsubstate
 
 abort more gracefully on .hgsubstate parsing error
 
   $ cp .hgsubstate .hgsubstate.old
-  >>> open('.hgsubstate', 'wb').write(b'\ninvalid')
+  >>> open('.hgsubstate', 'wb').write(b'\ninvalid') and None
   $ hg st --subrepos --cwd $TESTTMP -R $TESTTMP/repo
   abort: invalid subrepository revision specifier in 'repo/.hgsubstate' line 2
   [255]