tests: fix readline escape characters in heredoctest.py/test-url.py
This fix mirrors the changes made to test-doctest.py in b856071435f7
and 967adcf5910d.
Without this change, tests running heredoctest.py can fail on certain
versions of OS X when TERM is set to xterm-256color:
$ /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -m heredoctest <<EOF
> >>> open('b', 'w').write('this' * 1000)
> EOF
+ \x1b[?1034h (no-eol) (esc)
A similar problem occurs with test-url.py:
$ ./run-tests.py test-url.py
--- .../tests/test-url.py.out
+++ .../tests/test-url.py.err
@@ -0,0 +1 @@
+
ERROR: .../test-url.py output changed
!
Failed test-url.py: output changed
# Ran 1 tests, 0 skipped, 1 failed.
[ original upstream message ]
#!/usr/bin/env python"""Test the running system for features availability. Exit with zeroif all features are there, non-zero otherwise. If a feature name isprefixed with "no-", the absence of feature is tested."""importoptparseimportsysimporthghavechecks=hghave.checksdeflist_features():forname,featureinchecks.iteritems():desc=feature[1]printname+':',descdeftest_features():failed=0forname,featureinchecks.iteritems():check,_=featuretry:check()exceptException,e:print"feature %s failed: %s"%(name,e)failed+=1returnfailedparser=optparse.OptionParser("%prog [options] [features]")parser.add_option("--test-features",action="store_true",help="test available features")parser.add_option("--list-features",action="store_true",help="list available features")parser.add_option("-q","--quiet",action="store_true",help="check features silently")if__name__=='__main__':options,args=parser.parse_args()ifoptions.list_features:list_features()sys.exit(0)ifoptions.test_features:sys.exit(test_features())quiet=options.quietfailures=0deferror(msg):globalfailuresifnotquiet:sys.stderr.write(msg+'\n')failures+=1forfeatureinargs:negate=feature.startswith('no-')ifnegate:feature=feature[3:]iffeaturenotinchecks:error('skipped: unknown feature: '+feature)continuecheck,desc=checks[feature]try:available=check()exceptException,e:error('hghave check failed: '+feature)continueifnotnegateandnotavailable:error('skipped: missing feature: '+desc)elifnegateandavailable:error('skipped: system supports %s'%desc)iffailures!=0:sys.exit(1)