Skip to content

Commit

Permalink
Fix test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
magoorden committed Jun 13, 2024
1 parent 9d52bc1 commit 696349f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion strategoutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def run_stratego(model_file, query_file="", learning_args=None, verifyta_command
"query": f'"{query_file}"',
"config": merge_verifyta_args(learning_args)
}
args_list = [v for v in args.values() if v != ""]
args_list = [v for v in args.values() if v != "" and v != "\"\""]
task = " ".join(args_list)

process = subprocess.Popen(task, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
Expand Down
6 changes: 3 additions & 3 deletions test/test_strategoutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ def test_run_stratego_model_only(self):
with mock.patch("strategoutil.subprocess.Popen") as mock_Popen:
sutil.run_stratego("model.xml", verifyta_command="$HOME/verifyta")
# Below is the expected result with Popen default shell.
expected = "$HOME/verifyta model.xml"
expected = "$HOME/verifyta \"model.xml\""

mock_Popen.assert_called_with(expected, **self.POPEN_KWARGS)

def test_run_stratego_model_and_query(self):
with mock.patch("strategoutil.subprocess.Popen") as mock_Popen:
sutil.run_stratego("model.xml", "query.q")
# Below is the expected result with Popen default shell.
expected = "verifyta model.xml query.q"
expected = "verifyta \"model.xml\" \"query.q\""
mock_Popen.assert_called_with(expected, **self.POPEN_KWARGS)

def test_run_stratego_all_variables(self):
Expand All @@ -117,7 +117,7 @@ def test_run_stratego_all_variables(self):
}
sutil.run_stratego("model.xml", "query.q", learning_args, "verifyta")
# Below is the expected result with Popen default shell.
expected = ("verifyta model.xml query.q --learning-method 4 "
expected = ("verifyta \"model.xml\" \"query.q\" --learning-method 4 "
"--good-runs 100 --total-runs 100 --runs-pr-state 100 "
"--eval-runs 100 --max-iterations 30 --filter 0")
mock_Popen.assert_called_with(expected, **self.POPEN_KWARGS)
Expand Down

0 comments on commit 696349f

Please sign in to comment.