D7940: py3: make flush() line optional

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Sat Jan 18 07:43:04 UTC 2020


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

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))
 
 
+ at 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]



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


More information about the Mercurial-devel mailing list