Skip to content

Commit

Permalink
Merge pull request #229 from pyiron/cmd_fixes
Browse files Browse the repository at this point in the history
Fix command line utility
  • Loading branch information
jan-janssen committed Oct 3, 2023
2 parents f4e491c + 44d647e commit d093e41
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
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

0 comments on commit d093e41

Please sign in to comment.