summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Kislyuk <kislyuk@gmail.com>2018-08-04 11:20:44 -0700
committerAndrey Kislyuk <kislyuk@gmail.com>2018-08-04 11:20:44 -0700
commit6141f0c4cb4281f21b48b735e47084729f91330a (patch)
tree8fa7ebf9a1d6436e77a1255f1012f4ac8a0c4584
parent15aecb5fbe100dda09e9490f22ba99c0e40aeea8 (diff)
Fixup for e06d7a5: disable workaround before 3.5
-rwxr-xr-xtest/test.py3
-rwxr-xr-xyq/__init__.py2
2 files changed, 3 insertions, 2 deletions
diff --git a/test/test.py b/test/test.py
index 53077e1..ee500f0 100755
--- a/test/test.py
+++ b/test/test.py
@@ -157,7 +157,8 @@ class TestYq(unittest.TestCase):
err = "yq: Error converting JSON to TOML: cannot represent non-object types at top level"
self.run_yq('[1]', ["-t", "."], expect_exit_codes=[err])
- @unittest.skipIf(USING_PYTHON2, "argparse opt abbrev interferes w/opt passthrough, can't be disabled in Python 2")
+ @unittest.skipIf(sys.version_info < (3, 5),
+ "argparse option abbreviation interferes with opt passthrough, can't be disabled until Python 3.5")
def test_abbrev_opt_collisions(self):
with tempfile.TemporaryFile() as tf, tempfile.TemporaryFile() as tf2:
self.assertEqual(
diff --git a/yq/__init__.py b/yq/__init__.py
index e8ff814..083e530 100755
--- a/yq/__init__.py
+++ b/yq/__init__.py
@@ -93,7 +93,7 @@ def get_parser(program_name):
description = __doc__.replace("yq", program_name).replace("YAML", replace_yaml)
parser_args = dict(prog=program_name, description=description, formatter_class=argparse.RawTextHelpFormatter)
- if not USING_PYTHON2:
+ if sys.version_info >= (3, 5):
parser_args.update(allow_abbrev=False) # required to disambiguate options listed in jq_arg_spec
parser = Parser(**parser_args)
parser.add_argument("--yaml-output", "--yml-output", "-y", action="store_true", help=yaml_output_help)