diff --git a/strategoutil.py b/strategoutil.py index f220c63..d11fa1b 100644 --- a/strategoutil.py +++ b/strategoutil.py @@ -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) diff --git a/test/test_strategoutil.py b/test/test_strategoutil.py index a5346a1..97bee95 100644 --- a/test/test_strategoutil.py +++ b/test/test_strategoutil.py @@ -93,7 +93,7 @@ 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) @@ -101,7 +101,7 @@ 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): @@ -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)