Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
---------------

Expand Down
31 changes: 30 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -62,3 +61,33 @@ 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 install --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 install --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 install --force-reinstall --upgrade -e . && tmp/bin/pytest -n 2 -vvs
31 changes: 15 additions & 16 deletions src/commoncode/cliutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -365,24 +366,21 @@ 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,
**kwargs
)

Expand Down Expand Up @@ -418,6 +416,7 @@ def get_help_record(self, ctx):
return click.Option.get_help_record(self, ctx)



def validate_option_dependencies(ctx):
"""
Validate all PluggableCommandLineOption dependencies in the `ctx` Click
Expand Down
9 changes: 7 additions & 2 deletions tests/test_cliutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down