From patchwork Mon Oct 8 17:34:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2,of,5] tests: use environment variable indirectly From: Katsunori FUJIWARA X-Patchwork-Id: 35550 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Tue, 09 Oct 2018 02:34:37 +0900 # HG changeset patch # User FUJIWARA Katsunori # 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 < FILE.py OK: cat > FILE.py < 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