kislyuk / yq

Command-line YAML, XML, TOML processor - jq wrapper for YAML/XML/TOML documents
https://kislyuk.github.io/yq/
Apache License 2.0
2.57k stars 82 forks source link

Strange testcase in test_yq_arg_handling #114

Closed iv-m closed 2 years ago

iv-m commented 3 years ago

test_yq_arg_handling has the following line:

self.run_yq("{}", [], expect_exit_codes={0} if sys.stdin.isatty() else {2})

As far as I understood, that exit code selection should match this part of cli(...):

if sys.stdin.isatty() and not args.input_streams:
    parser.print_help()
    sys.exit(2)

But it does not, because:

So the test fails whenever it's run with non-TTY stdin, e.g. '< /dev/null' or in some automated build environment.