31 lines
1.4 KiB
Diff
31 lines
1.4 KiB
Diff
diff --git a/test/test.py b/test/test.py
|
|
index 9d06314..04fa59f 100755
|
|
--- test/test.py
|
|
+++ test/test.py
|
|
@@ -3,12 +3,13 @@
|
|
|
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
|
|
|
-import os, sys, unittest, tempfile, json, io
|
|
+import os, sys, unittest, tempfile, json, io, platform
|
|
|
|
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
|
from yq import main # noqa
|
|
|
|
USING_PYTHON2 = True if sys.version_info < (3, 0) else False
|
|
+USING_PYPY = True if platform.python_implementation() == "PyPy" else False
|
|
|
|
class TestYq(unittest.TestCase):
|
|
def run_yq(self, input_data, args, expect_exit_code=os.EX_OK):
|
|
@@ -45,7 +46,9 @@ def test_yq_arg_passthrough(self):
|
|
self.assertEqual(self.run_yq("{}", ["--arg", "foo", "bar", "--arg", "x", "y", "--indent", "4", "."]), "")
|
|
self.assertEqual(self.run_yq("{}", ["--arg", "foo", "bar", "--arg", "x", "y", "-y", "--indent", "4", ".x=$x"]),
|
|
"x: y\n")
|
|
- self.run_yq("{}", ["--indent", "9", "."], expect_exit_code=2)
|
|
+ err = "yq: Error running jq: {}Error: [Errno 32] Broken pipe{}".format("IO" if USING_PYTHON2 else "BrokenPipe",
|
|
+ ": '<fdopen>'." if USING_PYPY else ".")
|
|
+ self.run_yq("{}", ["--indent", "9", "."], expect_exit_code=err)
|
|
|
|
def fd_path(self, fh):
|
|
return "/dev/fd/{}".format(fh.fileno())
|
|
|