Patchwork [2,of,5] tests: use environment variable indirectly

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Oct. 8, 2018, 5:34 p.m.
Message ID <ecf28733d6b95c39068d.1539020077@blacknile>
Download mbox | patch
Permalink /patch/35550/
State Accepted
Headers show

Comments

Katsunori FUJIWARA - Oct. 8, 2018, 5:34 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@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.

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