Skip to content

Commit

Permalink
try to fix github-only flake errors
Browse files Browse the repository at this point in the history
  • Loading branch information
n8pease committed Aug 18, 2020
1 parent d6fd466 commit 864854d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/test_cliUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def test_addElipsisToMultiple(self):
The default behavior of click is to not add elipsis to options that
have `multiple=True`."""

@click.command()
@click.option("--things", cls=MWOption, multiple=True)
def cmd(things):
Expand All @@ -152,6 +153,7 @@ def test_addElipsisToNargs(self):
equal 1, but it does not put a space before the elipsis and we prefer
a space between the metavar and the elipsis."""
for numberOfArgs in (0, 1, 2): # nargs must be >= 0 for an option

@click.command()
@click.option("--things", cls=MWOption, nargs=numberOfArgs)
def cmd(things):
Expand Down Expand Up @@ -189,6 +191,7 @@ def test_help(self):
helpText = "Things help text."
for numberOfArgs in (-1, 1, 2):
for required in (True, False):

@click.command()
@self.things_argument(required=required, nargs=numberOfArgs, help=helpText)
@self.other_argument()
Expand All @@ -197,20 +200,20 @@ def cmd(things, other):
pass
result = self.runner.invoke(cmd, ["--help"])
self.assertEqual(result.exit_code, 0, clickResultMsg(result))
expectedOutut = ( # noqa E122 allow abnormal indent for string readability.
f"""Usage: cmd [OPTIONS] {'THINGS' if required else '[THINGS]'} {'... ' if numberOfArgs != 1 else ''}OTHER
expectedOutut = (f"""Usage: cmd [OPTIONS] {'THINGS' if required else '[THINGS]'} {'... ' if numberOfArgs != 1 else ''}OTHER
Cmd help text.
{helpText}
{self.otherHelpText}
""")
""") # noqa E122

This comment has been minimized.

Copy link
@timj

timj Aug 18, 2020

Member

The format is # noqa: E122 -- otherwise you mask all flake8 warnings.

This comment has been minimized.

Copy link
@n8pease

n8pease Aug 18, 2020

Author Contributor

thanks

self.assertIn(expectedOutut, result.output)

def testUse(self):
"""Test using the MWArgumentDecorator with a command."""
mock = MagicMock()

@click.command()
@self.things_argument()
def cli(things):
Expand All @@ -237,6 +240,7 @@ def testGetOpts(self):
def testUse(self):
"""Test using the MWOptionDecorator with a command."""
mock = MagicMock()

@click.command()
@self.test_option()
def cli(test):
Expand All @@ -250,6 +254,7 @@ def testOverride(self):
"""Test using the MWOptionDecorator with a command and overriding one
of the default values."""
mock = MagicMock()

@click.command()
@self.test_option(multiple=False)
def cli(test):
Expand Down Expand Up @@ -306,6 +311,7 @@ def test_section_function(self):
class MWPathTest(unittest.TestCase):

def getCmd(self, exists):

@click.command()
@click.option("--name", type=MWPath(exists=exists))
def cmd(name):
Expand Down

0 comments on commit 864854d

Please sign in to comment.