operating-system icon indicating copy to clipboard operation
operating-system copied to clipboard

Update conftest.py

Open gaurimakhija opened this issue 4 months ago • 1 comments

The shell.run_check() method likely returns a list of strings (lines from the command output). However, the current implementation assumes it's a single string, using "\n".join(shell.run_check(...)). This could lead to unintended behavior if the output is already a single string or not formatted as expected.

Fix: You can simplify this by directly parsing the result without joining the lines, as json.loads can handle strings with line breaks. If the output is indeed a list, join them properly.

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of JSON responses from shell commands, ensuring compatibility with both list and string outputs.
  • Refactor

    • Enhanced readability and formatting of the get_json_response function.

gaurimakhija avatar Oct 23 '24 17:10 gaurimakhija