diff options
author | Bob Ippolito <bob@redivi.com> | 2013-03-19 20:17:20 -0700 |
---|---|---|
committer | Bob Ippolito <bob@redivi.com> | 2013-03-19 20:17:20 -0700 |
commit | 35a7b157868ae1ca0e19346dba4124edb8576ee6 (patch) | |
tree | a4a824cc49146a0dc35598368bf12f85147c0a62 /simplejson/tests | |
parent | afa4fd25ca037c3ba4bb35aa99643715e1188ee0 (diff) | |
download | simplejson-35a7b157868ae1ca0e19346dba4124edb8576ee6.tar.gz |
fixes #65
Diffstat (limited to 'simplejson/tests')
-rw-r--r-- | simplejson/tests/test_tool.py | 17 |
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 |