# HG changeset patch # User Brodie Rao # Date 2011-11-01 19:25:54 # Node ID 474279be5addafdef5ea196f90c6c5434ff01cba # Parent f32f71f6c20c5477e4fb0b5f77d90c1be75f1e4a 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 < >>> 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. diff --git a/tests/heredoctest.py b/tests/heredoctest.py --- a/tests/heredoctest.py +++ b/tests/heredoctest.py @@ -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: diff --git a/tests/test-url.py b/tests/test-url.py --- a/tests/test-url.py +++ b/tests/test-url.py @@ -1,4 +1,4 @@ -import sys +import os def check(a, b): if a != b: @@ -232,4 +232,7 @@ def test_url(): 'foo/bar/baz' """ +if 'TERM' in os.environ: + del os.environ['TERM'] + doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE)