PY-29497: Do not provide sys.argv[1:] to behave since they are already provided

_jb_django_behave.py:
"scenario_n_options" already contains all options and arguments
behave needs (see how this method is called).
No need to duplicate them using "sys.argv[1:]"

+tests added
This commit is contained in:
Ilya.Kazakevich
2018-04-11 02:29:05 +03:00
parent 1611a60768
commit 1da58424f2
2 changed files with 4 additions and 5 deletions
+1 -2
View File
@@ -27,8 +27,7 @@ def run_as_django_behave(formatter_name, feature_names, scenario_n_options):
if apps.is_installed("behave_django"):
base = sys.argv[0]
rest = sys.argv[1:]
sys.argv = [base] + rest + ["behave", "-f{0}".format(formatter_name)] + feature_names + scenario_n_options
sys.argv = [base] + ["behave", "-f{0}".format(formatter_name)] + feature_names + scenario_n_options
print("manage.py " + " ".join(sys.argv[1:]))
ManagementUtility().execute()
return True