From 997eb61ae0aa10d2fe942e5b40d965df07fbdd16 Mon Sep 17 00:00:00 2001 From: Philippe Ombredanne Date: Tue, 25 May 2021 16:22:42 +0200 Subject: [PATCH 1/9] Run tests with all latests packages See: https://github.com/nexB/scancode-toolkit/issues/2529 Signed-off-by: Philippe Ombredanne --- azure-pipelines.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 31ef36f..50d8d25 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -62,3 +62,39 @@ jobs: python_versions: ['3.6', '3.7', '3.8', '3.9'] test_suites: all: tmp\Scripts\pytest -n 2 -vvs + + +################################################################################ +# Test using a plain pip install to get the latest of all wheels +################################################################################ + + + - template: etc/ci/azure-posix.yml + parameters: + job_name: ubuntu20_cpython_latest_from_pip + image_name: ubuntu-20.04 + python_versions: ['3.6', '3.7', '3.8', '3.9'] + test_suites: + all: + - tmp/bin/pip --force-reinstall --upgrade -e . + - tmp/bin/pytest -n 2 -vvs + + - template: etc/ci/azure-win.yml + parameters: + job_name: win2019_cpython_latest_from_pip + image_name: windows-2019 + python_versions: ['3.6', '3.7', '3.8', '3.9'] + test_suites: + all: + - tmp\Scripts\pip --force-reinstall --upgrade -e . + - tmp\Scripts\pytest -n 2 -vvs + + - template: etc/ci/azure-posix.yml + parameters: + job_name: macos1015_cpython_latest_from_pip + image_name: macos-10.15 + python_versions: ['3.6', '3.7', '3.8', '3.9'] + test_suites: + all: + - tmp/bin/pip --force-reinstall --upgrade -e . + - tmp/bin/pytest -n 2 -vvs From bd127b3f77a6b789a746e19676d62a595cd02c83 Mon Sep 17 00:00:00 2001 From: Philippe Ombredanne Date: Tue, 25 May 2021 16:24:02 +0200 Subject: [PATCH 2/9] Remove un-needed click unicode workaround Signed-off-by: Philippe Ombredanne --- src/commoncode/cliutils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commoncode/cliutils.py b/src/commoncode/cliutils.py index 9e51a46..e685c9b 100644 --- a/src/commoncode/cliutils.py +++ b/src/commoncode/cliutils.py @@ -9,7 +9,7 @@ import sys import click -click.disable_unicode_literals_warning = True + from click.utils import echo from click.termui import style from click.types import BoolParamType From 3aa39a08aee5f0e6cf35322dbb1d53f9110a64e7 Mon Sep 17 00:00:00 2001 From: Philippe Ombredanne Date: Tue, 25 May 2021 16:33:53 +0200 Subject: [PATCH 3/9] Format test code for clarity See: https://github.com/nexB/scancode-toolkit/issues/2529 Signed-off-by: Philippe Ombredanne --- tests/test_cliutils.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/test_cliutils.py b/tests/test_cliutils.py index b30ac12..a65cfb1 100644 --- a/tests/test_cliutils.py +++ b/tests/test_cliutils.py @@ -138,8 +138,13 @@ def test_GroupedHelpCommand_help_with_group(self): from commoncode.cliutils import CORE_GROUP @click.command(name='scan', cls=GroupedHelpCommand) - @click.option('--opt', is_flag=True, help='Help text for option', - help_group=CORE_GROUP, cls=PluggableCommandLineOption) + @click.option( + '--opt', + is_flag=True, + help='Help text for option', + help_group=CORE_GROUP, + cls=PluggableCommandLineOption, + ) def scan(opt): pass From 475fc9f107ff8d20e5edf55133addaa299d24e2f Mon Sep 17 00:00:00 2001 From: Philippe Ombredanne Date: Tue, 25 May 2021 16:35:57 +0200 Subject: [PATCH 4/9] Use named arguments to support future versions - In particular this help things work with Click 8.x - The hidden argument is now standard so remove it together with special code. See: https://github.com/nexB/scancode-toolkit/issues/2529 Signed-off-by: Philippe Ombredanne --- src/commoncode/cliutils.py | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/src/commoncode/cliutils.py b/src/commoncode/cliutils.py index e685c9b..e42db16 100644 --- a/src/commoncode/cliutils.py +++ b/src/commoncode/cliutils.py @@ -352,6 +352,7 @@ def __init__( allow_from_autoenv=True, type=None, # NOQA help=None, # NOQA + hidden=False, # custom additions # # a string that set the CLI help group for this option help_group=MISC_GROUP, @@ -365,24 +366,22 @@ def __init__( # a sequence of other option name strings that this option # conflicts with if they are set conflicting_options=(), - # a flag set to True if this option should be hidden from the CLI help - hidden=False, **kwargs ): - super(PluggableCommandLineOption, self).__init__( - param_decls, - show_default, - prompt, - confirmation_prompt, - hide_input, - is_flag, - flag_value, - multiple, - count, - allow_from_autoenv, - type, - help, + param_decls=param_decls, + show_default=show_default, + prompt=prompt, + confirmation_prompt=confirmation_prompt, + hide_input=hide_input, + is_flag=is_flag, + flag_value=flag_value, + multiple=multiple, + count=count, + allow_from_autoenv=allow_from_autoenv, + type=type, + help=help, + hidden=hidden, **kwargs ) @@ -413,10 +412,6 @@ def validate_dependencies(self, ctx, value): _validate_option_dependencies(ctx, self, value, self.required_options, required=True) _validate_option_dependencies(ctx, self, value, self.conflicting_options, required=False) - def get_help_record(self, ctx): - if not self.hidden: - return click.Option.get_help_record(self, ctx) - def validate_option_dependencies(ctx): """ From d608300890af162e7e70631c71c70708d2923dde Mon Sep 17 00:00:00 2001 From: Philippe Ombredanne Date: Tue, 25 May 2021 16:41:07 +0200 Subject: [PATCH 5/9] Update CHANGELOG See: https://github.com/nexB/scancode-toolkit/issues/2529 Signed-off-by: Philippe Ombredanne --- CHANGELOG.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a807f85..6c9e4ec 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,13 @@ vNext ----- +Version 21.5.25 +--------------- + +- Fix click-realted bug https://github.com/nexB/scancode-toolkit/issues/2529 +- Add tests to run on the latest of every dependency + + Version 21.5.12 --------------- From e8b6dd7c7ad963397070660c4eab30b47e3f3dfb Mon Sep 17 00:00:00 2001 From: Philippe Ombredanne Date: Tue, 25 May 2021 16:52:21 +0200 Subject: [PATCH 6/9] Restore handling of click.Option.hidden=True This is now standard but only in Click version 8 We still nee to do it ourselves for older versions. Signed-off-by: Philippe Ombredanne --- src/commoncode/cliutils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/commoncode/cliutils.py b/src/commoncode/cliutils.py index e42db16..1a2e427 100644 --- a/src/commoncode/cliutils.py +++ b/src/commoncode/cliutils.py @@ -381,7 +381,6 @@ def __init__( allow_from_autoenv=allow_from_autoenv, type=type, help=help, - hidden=hidden, **kwargs ) @@ -412,6 +411,11 @@ def validate_dependencies(self, ctx, value): _validate_option_dependencies(ctx, self, value, self.required_options, required=True) _validate_option_dependencies(ctx, self, value, self.conflicting_options, required=False) + def get_help_record(self, ctx): + if not self.hidden: + return click.Option.get_help_record(self, ctx) + + def validate_option_dependencies(ctx): """ From f3142a1d14b88313d00ebf123ff98036286bdc21 Mon Sep 17 00:00:00 2001 From: Philippe Ombredanne Date: Tue, 25 May 2021 16:57:45 +0200 Subject: [PATCH 7/9] Correct CI pipelines syntax Signed-off-by: Philippe Ombredanne --- azure-pipelines.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 50d8d25..ffc7e0a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -75,9 +75,7 @@ jobs: image_name: ubuntu-20.04 python_versions: ['3.6', '3.7', '3.8', '3.9'] test_suites: - all: - - tmp/bin/pip --force-reinstall --upgrade -e . - - tmp/bin/pytest -n 2 -vvs + all: tmp/bin/pip --force-reinstall --upgrade -e . && tmp/bin/pytest -n 2 -vvs - template: etc/ci/azure-win.yml parameters: @@ -85,9 +83,7 @@ jobs: image_name: windows-2019 python_versions: ['3.6', '3.7', '3.8', '3.9'] test_suites: - all: - - tmp\Scripts\pip --force-reinstall --upgrade -e . - - tmp\Scripts\pytest -n 2 -vvs + all: tmp\Scripts\pip --force-reinstall --upgrade -e . && tmp\Scripts\pytest -n 2 -vvs - template: etc/ci/azure-posix.yml parameters: @@ -95,6 +91,4 @@ jobs: image_name: macos-10.15 python_versions: ['3.6', '3.7', '3.8', '3.9'] test_suites: - all: - - tmp/bin/pip --force-reinstall --upgrade -e . - - tmp/bin/pytest -n 2 -vvs + all: tmp/bin/pip --force-reinstall --upgrade -e . && tmp/bin/pytest -n 2 -vvs From 9f556ea08d15b14df5517501dcccbf25806bbf78 Mon Sep 17 00:00:00 2001 From: Philippe Ombredanne Date: Tue, 25 May 2021 17:40:23 +0200 Subject: [PATCH 8/9] Dummy commit to trigger a build Signed-off-by: Philippe Ombredanne --- azure-pipelines.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ffc7e0a..0edcbac 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,4 +1,3 @@ - ################################################################################ # We use Azure to run the full tests suites on multiple Python 3.x # on multiple Windows, macOS and Linux versions all on 64 bits From 475e625984a17114fab7c76c9c390f596476b6ed Mon Sep 17 00:00:00 2001 From: Philippe Ombredanne Date: Tue, 25 May 2021 17:48:13 +0200 Subject: [PATCH 9/9] Use correct pip installation command Signed-off-by: Philippe Ombredanne --- azure-pipelines.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0edcbac..7c21072 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -74,7 +74,7 @@ jobs: image_name: ubuntu-20.04 python_versions: ['3.6', '3.7', '3.8', '3.9'] test_suites: - all: tmp/bin/pip --force-reinstall --upgrade -e . && tmp/bin/pytest -n 2 -vvs + all: tmp/bin/pip install --force-reinstall --upgrade -e . && tmp/bin/pytest -n 2 -vvs - template: etc/ci/azure-win.yml parameters: @@ -82,7 +82,7 @@ jobs: image_name: windows-2019 python_versions: ['3.6', '3.7', '3.8', '3.9'] test_suites: - all: tmp\Scripts\pip --force-reinstall --upgrade -e . && tmp\Scripts\pytest -n 2 -vvs + all: tmp\Scripts\pip install --force-reinstall --upgrade -e . && tmp\Scripts\pytest -n 2 -vvs - template: etc/ci/azure-posix.yml parameters: @@ -90,4 +90,4 @@ jobs: image_name: macos-10.15 python_versions: ['3.6', '3.7', '3.8', '3.9'] test_suites: - all: tmp/bin/pip --force-reinstall --upgrade -e . && tmp/bin/pytest -n 2 -vvs + all: tmp/bin/pip install --force-reinstall --upgrade -e . && tmp/bin/pytest -n 2 -vvs