[PATCH 2 of 5] tests: use environment variable indirectly

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Mon Oct 8 13:34:37 EDT 2018


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1534994681 -32400
#      Thu Aug 23 12:24:41 2018 +0900
# Node ID ecf28733d6b95c39068d7f593c0b9a98a068509f
# Parent  fe5486e76d2610bdd20837b487deb3f0a9a2d820
# Available At https://bitbucket.org/foozy/mercurial-wip
#              hg pull https://bitbucket.org/foozy/mercurial-wip -r ecf28733d6b9
# EXP-Topic contrib-improve-import-checker
tests: use environment variable indirectly

Using environment variable directly in heredoc python code will cause
syntax error at checking module importation by import-checker.py
strictly, because "$varname" is invalid in Python syntax. "$varname"
becomes valid after environment variable substitution by shell at
writing text into file.

Current import-checker.py overlooks code fragment changed in this
patch, because of a restriction below for a line starting code
fragment.

  - filename must be specified before limit mark

    NG: cat <<EOF > FILE.py
    OK: cat > FILE.py <<EOF

import-checker.py itself is fixed in subsequent patch.

diff --git a/tests/test-pending.t b/tests/test-pending.t
--- a/tests/test-pending.t
+++ b/tests/test-pending.t
@@ -50,7 +50,7 @@ python hook
   >     f = open(fpath, 'w')
   >     f.close()
   >     # wait for ack - caller should delete the notify file
-  >     i = $maxwait
+  >     i = int("$maxwait")
   >     while os.path.exists(fpath) and i > 0:
   >         time.sleep(1)
   >         i -= 1


More information about the Mercurial-devel mailing list