tests: fix readline escape characters in heredoctest.py/test-url.py stable
authorBrodie Rao <brodie@bitheap.org>
Tue, 01 Nov 2011 12:25:54 -0700
branchstable
changeset 1109 8458561f6f94
parent 1108 168da136346a
child 1110 d5b3404b82ce
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 ]
tests/heredoctest.py
--- a/tests/heredoctest.py	Thu Oct 13 17:54:35 2011 +0200
+++ b/tests/heredoctest.py	Tue Nov 01 12:25:54 2011 -0700
@@ -1,6 +1,9 @@
 import doctest, tempfile, os, sys
 
 if __name__ == "__main__":
+    if 'TERM' in os.environ:
+        del os.environ['TERM']
+
     fd, name = tempfile.mkstemp(suffix='hg-tst')
 
     try: