[PATCH 10 of 10] test-demandimport.py: PyPy support

Dan Villiom Podlaski Christiansen danchr at gmail.com
Wed Dec 1 15:35:03 CST 2010


# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr at gmail.com>
# Date 1291236368 -3600
# Node ID 7667e020c286e05db1b41c8c4d2bc317449835da
# Parent  832567e85b1e38f83903290fa075da342732213e
test-demandimport.py: PyPy support

The stringification of sys.stderr is different in PyPy:

$ pypy -c 'import sys; print sys.stderr'
<open file '<fdopen>', mode 'w' at 0x00a42080>

$ python -c 'import sys; print sys.stderr'
<open file '<stderr>', mode 'w' at 0x10025a270>

The test will now ignore the exact value between the angle brackets.

diff --git a/tests/test-demandimport.py b/tests/test-demandimport.py
--- a/tests/test-demandimport.py
+++ b/tests/test-demandimport.py
@@ -8,6 +8,7 @@ def f(obj):
     l = repr(obj)
     l = rsub("0x[0-9a-fA-F]+", "0x?", l)
     l = rsub("from '.*'", "from '?'", l)
+    l = rsub("'<[a-z]*>'", "'<whatever>'", l)
     return l
 
 import os
diff --git a/tests/test-demandimport.py.out b/tests/test-demandimport.py.out
--- a/tests/test-demandimport.py.out
+++ b/tests/test-demandimport.py.out
@@ -11,5 +11,5 @@ fred = <unloaded module 're'>
 fred.sub = <function sub at 0x?>
 fred = <proxied module 're'>
 re = <unloaded module 'sys'>
-re.stderr = <open file '<stderr>', mode 'w' at 0x?>
+re.stderr = <open file '<whatever>', mode 'w' at 0x?>
 re = <proxied module 'sys'>


More information about the Mercurial-devel mailing list