summaryrefslogtreecommitdiff
path: root/simplejson/tests
diff options
context:
space:
mode:
authorBob Ippolito <bob@redivi.com>2013-03-19 20:17:20 -0700
committerBob Ippolito <bob@redivi.com>2013-03-19 20:17:20 -0700
commit35a7b157868ae1ca0e19346dba4124edb8576ee6 (patch)
treea4a824cc49146a0dc35598368bf12f85147c0a62 /simplejson/tests
parentafa4fd25ca037c3ba4bb35aa99643715e1188ee0 (diff)
downloadsimplejson-35a7b157868ae1ca0e19346dba4124edb8576ee6.tar.gz
fixes #65
Diffstat (limited to 'simplejson/tests')
-rw-r--r--simplejson/tests/test_tool.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/simplejson/tests/test_tool.py b/simplejson/tests/test_tool.py
index af3c4ba..ac2a14c 100644
--- a/simplejson/tests/test_tool.py
+++ b/simplejson/tests/test_tool.py
@@ -5,6 +5,21 @@ import textwrap
import unittest
import subprocess
import tempfile
+try:
+ # Python 3.x
+ from test.support import strip_python_stderr
+except ImportError:
+ # Python 2.6+
+ try:
+ from test.test_support import strip_python_stderr
+ except ImportError:
+ # Python 2.5
+ import re
+ def strip_python_stderr(stderr):
+ return re.sub(
+ r"\[\d+ refs\]\r?\n?$".encode(),
+ "".encode(),
+ stderr).strip()
class TestTool(unittest.TestCase):
data = """
@@ -46,7 +61,7 @@ class TestTool(unittest.TestCase):
stderr=subprocess.PIPE,
stdout=subprocess.PIPE)
out, err = proc.communicate(data)
- self.assertEqual(err, ''.encode())
+ self.assertEqual(strip_python_stderr(err), ''.encode())
self.assertEqual(proc.returncode, 0)
return out