From 1da58424f2679e24d4afe74aff894ace2b38fbe7 Mon Sep 17 00:00:00 2001 From: "Ilya.Kazakevich" Date: Wed, 11 Apr 2018 02:29:05 +0300 Subject: [PATCH] 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 --- python/helpers/pycharm/_jb_django_behave.py | 3 +-- python/setup-test-environment/build.gradle | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/python/helpers/pycharm/_jb_django_behave.py b/python/helpers/pycharm/_jb_django_behave.py index f7acf323bb90..81d5b179c0ee 100644 --- a/python/helpers/pycharm/_jb_django_behave.py +++ b/python/helpers/pycharm/_jb_django_behave.py @@ -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 diff --git a/python/setup-test-environment/build.gradle b/python/setup-test-environment/build.gradle index 9c0a7b3bd45e..9069395481ae 100644 --- a/python/setup-test-environment/build.gradle +++ b/python/setup-test-environment/build.gradle @@ -86,8 +86,8 @@ envs { createPython("py35_django20_full", "3.5.4", - ["ipython==2.1", "django==2.0", "behave", "jinja2", "tox>=2.0", "nose", "pytest", "django-nose"], - "python3.4\npython3\nipython\nipython200\nskeletons\ndjango\nbehave\ntox\njinja2\npython34\npackaging\npytest\nnose\ndjango-nose", + ["ipython==2.1", "django==2.0", "behave", "jinja2", "tox>=2.0", "nose", "pytest", "django-nose", "behave-django"], + "python3.4\npython3\nipython\nipython200\nskeletons\ndjango\nbehave\ntox\njinja2\npython34\npackaging\npytest\nnose\ndjango-nose\nbehave-django\ndjango20", true) // Mostly for tox @@ -107,7 +107,7 @@ envs { createPython("pyqt_env", "3.5.4", ["pyqt5==5.10.1"], "pyqt5", true) } - createPython("django_latest", "3.5.3", ["django"], "python3.5\ndjango", true) + createPython("django_latest", "3.5.3", ["django", "behave-django", "behave"], "python3.5\ndjango\ndjango20\nbehave\nbehave-django\ndjango20", true) if (Os.isFamily(Os.FAMILY_WINDOWS)) { // Only windows needs ironPython