Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix command line utility #229

Merged
merged 4 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pysqa/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
from pysqa.cmd import command_line

if __name__ == "__main__":
command_line(sys.argv[1:])
command_line(arguments_lst=sys.argv[1:])
6 changes: 4 additions & 2 deletions pysqa/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from pysqa.utils.execute import execute_command


def command_line(argv, execute_command=execute_command):
def command_line(arguments_lst=None, execute_command=execute_command):
"""
Parse the command line arguments.

Expand All @@ -25,9 +25,11 @@ def command_line(argv, execute_command=execute_command):
run_time_max = None
command = None
job_id = None
if arguments_lst is None:
arguments_lst = sys.argv[1:]
try:
opts, args = getopt.getopt(
argv,
arguments_lst,
"f:pq:j:w:n:m:t:b:c:ri:dslh",
[
"config_directory=",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def setUpClass(cls):
@unittest.mock.patch('sys.stdout', new_callable=io.StringIO)
def assert_stdout_command_line(self, cmd_args, execute_command, expected_output, mock_stdout):
command_line(
argv=cmd_args,
arguments_lst=cmd_args,
execute_command=execute_command
)
self.assertEqual(mock_stdout.getvalue(), expected_output)
Expand Down
Loading