Patchwork D7940: py3: make flush() line optional

login
register
mail settings
Submitter phabricator
Date Jan. 18, 2020, 7:43 a.m.
Message ID <differential-rev-PHID-DREV-tsvbxr2cqxdwqrdyj25h-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/44518/
State New
Headers show

Comments

phabricator - Jan. 18, 2020, 7:43 a.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This line only appears on Python 3.5, not on 2.7 or 3.6+. Why, I have
  no clue. I suspect a weird regression in the bowels of Python's
  I/O system.
  
  Our test format doesn't support combining conditionals. So I add
  pyexactXY checks to check for an exact major.minor Python version.
  Sadly, this won't be the only test requiring an exception for
  Python 3.5.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/hghave.py
  tests/test-ssh-proto.t

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel
phabricator - Jan. 20, 2020, 2:03 p.m.
pulkit added inline comments.

INLINE COMMENTS

> test-ssh-proto.t:114
>    capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
> -  o> flush() -> None
> +  o> flush() -> None (no-pyexact35 !)
>  

Reviewing later patches, I see that `(py3 no-py3.6)` can be used for this.

REPOSITORY
  rHG Mercurial

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7940/new/

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

To: indygreg, #hg-reviewers, pulkit
Cc: mercurial-devel
phabricator - Feb. 5, 2020, 11:06 p.m.
This revision now requires changes to proceed.
marmoute added inline comments.
marmoute requested changes to this revision.

INLINE COMMENTS

> hghave.py:783
>  
> +@checkvers("pyexact", "Python == %s", (2.7, 3.5, 3.6, 3.7, 3.8, 3.9))
> +def has_python_exact(v):

can we pre-generate more python version ? It help running "current" extension test againts "older" mercurial version.

> pulkit wrote in test-ssh-proto.t:114
> Reviewing later patches, I see that `(py3 no-py3.6)` can be used for this.

+1 are we missing anything that prevent this to be used?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7940/new/

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

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

Patch

diff --git a/tests/test-ssh-proto.t b/tests/test-ssh-proto.t
--- a/tests/test-ssh-proto.t
+++ b/tests/test-ssh-proto.t
@@ -111,7 +111,7 @@ 
   o>     capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n
   440
   capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
-  o> flush() -> None
+  o> flush() -> None (no-pyexact35 !)
 
   $ hg debugserve --sshstdio --logiofile $TESTTMP/io << EOF
   > hello
@@ -125,7 +125,7 @@ 
   o>     440\n
   o> write(440) -> 440:
   o>     capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n
-  o> flush() -> None
+  o> flush() -> None (no-pyexact35 !)
 
   $ cd ..
 
diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -780,6 +780,14 @@ 
     return (py_major, py_minor) >= (int(major), int(minor))
 
 
+@checkvers("pyexact", "Python == %s", (2.7, 3.5, 3.6, 3.7, 3.8, 3.9))
+def has_python_exact(v):
+    major, minor = v.split(".")[0:2]
+    py_major, py_minor = sys.version_info.major, sys.version_info.minor
+
+    return (py_major, py_minor) == (int(major), int(minor))
+
+
 @check("py3", "running with Python 3.x")
 def has_py3():
     return 3 == sys.version_info[0]