Repository: altwalker/altwalker (language: python)

Issue:
Remove the deprecated `-p`, `--port` and `--url` options



Discussion / hints:

Fix patch:
diff --git a/altwalker/cli.py b/altwalker/cli.py
index 751c0f5..4244d94 100644
--- a/altwalker/cli.py
+++ b/altwalker/cli.py
@@ -62,6 +62,9 @@
     default="python", show_default=True,
     help="Configure the executor to be used.")
 
+executor_url_option = click.option(
+    "--executor-url", help="Sets the url for the executor.")
+
 import_mode_option = click.option(
     "--import-mode", "import_mode",
     type=click.Choice(get_supported_loaders(), case_sensitive=False),
@@ -70,21 +73,10 @@
 )
 
 
-url_option = click.option(
-    "--url", help="This option is deprecated, use --executor-url instead. [deprecated]")
-
-executor_url_option = click.option(
-    "--executor-url", help="Sets the url for the executor.")
-
-
 graphwalker_host_option = click.option(
     "--gw-host",
     help="Sets the host of the GraphWalker REST service.")
 
-port_option = click.option(
-    "--port", "-p", type=int,
-    help="This option is deprecated, use --gw-port instead. [deprecated]")
-
 graphwalker_port_option = click.option(
     "--gw-port", default=8887, show_default=True,
     help="Sets the port of the GraphWalker REST service.")
@@ -161,15 +153,10 @@ def check(models, blocked):
 @click.argument("test_package", type=click.Path(exists=True))
 @click.option("--suggestions/--no-suggestions", "suggestions", default=True, is_flag=True,
               help="If set will print code suggestions for missing elements.", show_default=True)
-@add_options([model_file_option, executor_option, url_option, executor_url_option, import_mode_option])
+@add_options([model_file_option, executor_option, executor_url_option, import_mode_option])
 def verify(test_package, model_paths, **options):
     """Verify and analyze test code for issues."""
 
-    if options["url"]:
-        warnings.warn("The --url option is deprecated, use --executor-url instead.", DeprecationWarning)
-
-    options["executor_url"] = options["url"] or options["executor_url"]
-
     status = cli_verify(
         test_package, model_paths,
         executor_type=options["executor_type"], executor_url=options["executor_url"],
@@ -208,24 +195,14 @@ def generate(output_dir, model_paths, language):
     cls=HelpColorsCommand,
     help_options_custom_colors=HELP_OPTIONS_CUSTOM_COLORS)
 @click.argument("test_package", type=click.Path(exists=True))
-@add_options([graphwalker_host_option, port_option, graphwalker_port_option,
-              model_and_generator_option, start_element_option, executor_option, url_option, executor_url_option,
+@add_options([graphwalker_host_option, graphwalker_port_option,
+              model_and_generator_option, start_element_option, executor_option, executor_url_option,
               verbose_option, unvisited_option, blocked_option,
               report_path_option, report_path_file_option, report_file_option,
               report_xml_option, report_xml_file_option, import_mode_option])
 def online(test_package, models, **options):
     """Generate and run a test path."""
 
-    if options["port"]:
-        warnings.warn("The --port/-p option is deprecated, use --gw-port instead.", DeprecationWarning)
-
-    options["gw_port"] = options["port"] or options["gw_port"]
-
-    if options["url"]:
-        warnings.warn("The --url option is deprecated, use --executor-url instead.", DeprecationWarning)
-
-    options["executor_url"] = options["url"] or options["executor_url"]
-
     cli_online(
         test_package, models, executor_type=options["executor_type"], executor_url=options["executor_url"],
         import_mode=options["import_mode"],
@@ -253,15 +230,10 @@ def offline(models, **options):
     help_options_custom_colors=HELP_OPTIONS_CUSTOM_COLORS)
 @click.argument("test_package", type=click.Path(exists=True))
 @click.argument("steps_file", type=click.Path(exists=True, dir_okay=False))
-@add_options([executor_option, url_option, executor_url_option, import_mode_option,
+@add_options([executor_option, executor_url_option, import_mode_option,
               report_path_option, report_path_file_option, report_file_option,
               report_xml_option, report_xml_file_option])
-def walk(test_package, steps_file, executor_type, url, executor_url, **options):
+def walk(test_package, steps_file, executor_type, executor_url, **options):
     """Run the tests with steps from a file."""
 
-    if url:
-        warnings.warn("The --url option is deprecated, use --executor-url instead.", DeprecationWarning)
-
-    executor_url = url or executor_url
-
     cli_walk(test_package, steps_file, executor_type=executor_type, executor_url=executor_url, **options)


Test patch:
diff --git a/tests/unit/test_cli.py b/tests/unit/test_cli.py
index 6cd3c35..dc43b3e 100644
--- a/tests/unit/test_cli.py
+++ b/tests/unit/test_cli.py
@@ -17,7 +17,6 @@
 EXECUTOR_TYPE_OPTIONS = ["--executor", "-x", "--language", "-l"]
 LANGUAGE_OPTIONS = ["--language", "-l"]
 NO_GIT_OPTIONS = ["--no-git", "-n"]
-PORT_OPTIONS = ["--port", "-p"]
 START_ELEMENT_OPTIONS = ["--start-element", "-e"]
 VERBOSE_OPTIONS = ["--verbose", "-o"]
 UNVISITED_OPTIONS = ["--unvisited", "-u"]
@@ -176,22 +175,7 @@ def test_executor_type(self, cli_verify_mock, executor_type_option, executor_typ
                 suggestions=True,
             )
 
-    def test_url(self, cli_verify_mock):
-        with run_isolation(self.runner, self.files, folders=self.folders):
-            with pytest.warns(DeprecationWarning):
-                result = self.runner.invoke(
-                    verify, ["--url", "http://127.0.0.1:5000/", "tests", "-m", "models.json"])
-
-                assert result.exit_code == 0, result.output
-                cli_verify_mock.assert_called_once_with(
-                    "tests", ("models.json", ),
-                    executor_type="python",
-                    executor_url="http://127.0.0.1:5000/",
-                    import_mode=ImportModes.IMPORTLIB,
-                    suggestions=True,
-                )
-
-    def test_execuort_url(self, cli_verify_mock):
+    def test_executor_url(self, cli_verify_mock):
         with run_isolation(self.runner, self.files, folders=self.folders):
             result = self.runner.invoke(
                 verify, ["--executor-url", "http://127.0.0.1:5000/", "tests", "-m", "models.json"])
@@ -564,32 +548,6 @@ def test_blocked(self, cli_online_mock, blocked_option):
                 report_xml_file=None
             )
 
-    @pytest.mark.parametrize("port_option", PORT_OPTIONS)
-    def test_port(self, cli_online_mock, port_option):
-        with run_isolation(self.runner, self.files, folders=self.folders):
-            with pytest.warns(DeprecationWarning):
-                result = self.runner.invoke(
-                    online, ["package", "-m", "models.json", "random(vertex_coverage(100))", port_option, 8080])
-
-                assert result.exit_code == 0, result.output
-                cli_online_mock.assert_called_once_with(
-                    "package", (("models.json", "random(vertex_coverage(100))"), ),
-                    executor_type="python",
-                    executor_url=None,
-                    import_mode=ImportModes.IMPORTLIB,
-                    gw_host=None,
-                    gw_port=8080,
-                    start_element=None,
-                    blocked=False,
-                    unvisited=False,
-                    verbose=False,
-                    report_file=None,
-                    report_path=False,
-                    report_path_file=None,
-                    report_xml=False,
-                    report_xml_file=None
-                )
-
     def test_gw_port(self, cli_online_mock):
         with run_isolation(self.runner, self.files, folders=self.folders):
             result = self.runner.invoke(
@@ -614,32 +572,6 @@ def test_gw_port(self, cli_online_mock):
                 report_xml_file=None
             )
 
-    def test_url(self, cli_online_mock):
-        with run_isolation(self.runner, self.files, folders=self.folders):
-            with pytest.warns(DeprecationWarning):
-                result = self.runner.invoke(
-                    online,
-                    ["package", "-m", "models.json", "random(vertex_coverage(100))", "--url", "http://localhost:8080"])
-
-                assert result.exit_code == 0, result.output
-                cli_online_mock.assert_called_once_with(
-                    "package", (("models.json", "random(vertex_coverage(100))"), ),
-                    executor_type="python",
-                    executor_url="http://localhost:8080",
-                    import_mode=ImportModes.IMPORTLIB,
-                    gw_host=None,
-                    gw_port=8887,
-                    start_element=None,
-                    blocked=False,
-                    unvisited=False,
-                    verbose=False,
-                    report_file=None,
-                    report_path=False,
-                    report_path_file=None,
-                    report_xml=False,
-                    report_xml_file=None
-                )
-
     def test_executor_url(self, cli_online_mock):
         with run_isolation(self.runner, self.files, folders=self.folders):
             result = self.runner.invoke(
@@ -976,25 +908,6 @@ def test_executor_type(self, cli_walk_mock, executor_type_option, executor_type)
                 report_xml_file=None
             )
 
-    def test_url(self, cli_walk_mock):
-        with run_isolation(self.runner, self.files, folders=self.folders):
-            with pytest.warns(DeprecationWarning):
-                result = self.runner.invoke(walk, ["package", "steps.json", "--url", "http://localhost:8080/"])
-
-                assert result.exit_code == 0, result.output
-                cli_walk_mock.assert_called_once_with(
-                    "package",
-                    "steps.json",
-                    executor_type="python",
-                    executor_url="http://localhost:8080/",
-                    import_mode=ImportModes.IMPORTLIB,
-                    report_file=None,
-                    report_path=False,
-                    report_path_file=None,
-                    report_xml=False,
-                    report_xml_file=None
-                )
-
     def test_executor_url(self, cli_walk_mock):
         with run_isolation(self.runner, self.files, folders=self.folders):
             result = self.runner.invoke(walk, ["package", "steps.json", "--executor-url", "http://localhost:8080/"])