Git Product home page Git Product logo

click-aliases's Issues

Support for aliases when importing command to CLI using `add_command`

Do you plan on adding support for the following situation?

# cli.py
import click

from click_aliases import ClickAliasedGroup

from foo import foo


@click.group(cls=ClickAliasedGroup)
def cli():
    pass


cli.add_command(foo, aliases=['bar', 'baz', 'qux'])

if __name__ == "__main__":
    cli()

# foo.py
import click


@click.command()
def foo():
    """Run a command."""
    click.echo('foo')

Tests fail on openSUSE Leap 15.1 Python 3

All of the tests are failing on openSUSE Leap Python 3 , but not on openSUSE Tumbleweed or openSUSE Leap Python 2.

This could be an issue with a specific version of click, or could be the pytest version being used. I'll dig into it, but dont want it to slip away, hence raising the issue.

...
[   12s] [130/160] cumulate python3-click-6.7-lp151.3.2
...
[   41s] ============================= test session starts ==============================
[   41s] platform linux -- Python 3.6.5, pytest-3.10.1, py-1.5.2, pluggy-0.8.0
[   41s] rootdir: /home/abuild/rpmbuild/BUILD/click-aliases-1.0.1, inifile:
[   41s] collected 9 items
[   41s] 
[   41s] tests/test_basic.py FFF
[   41s] tests/test_foobar.py FFF
[   41s] tests/test_naval.py FFF
[   41s] 
[   41s] =================================== FAILURES ===================================
[   41s] __________________________________ test_help ___________________________________
[   41s] 
[   41s] runner = <click.testing.CliRunner object at 0x7f4dc3dbbef0>
[   41s] 
[   41s]     def test_help(runner):
[   41s]         result = runner.invoke(cli)
[   41s] >       assert result.output == TEST_HELP
[   41s] E       AssertionError: assert '' == 'Usage: cli [OPTIONS] COMMAN...exit.\n\nCommands:\n  foo\n'
[   41s] E         + Usage: cli [OPTIONS] COMMAND [ARGS]...
[   41s] E         + 
[   41s] E         + Options:
[   41s] E         +   --help  Show this message and exit.
[   41s] E         + 
[   41s] E         + Commands:
[   41s] E         +   foo
[   41s] 
[   41s] tests/test_basic.py:36: AssertionError
...

https://build.opensuse.org/package/show/home:jayvdb:py-new/python-click-aliases

click-aliases-leap.log

Broken with click 7

https://travis-ci.org/jayvdb/click-aliases/jobs/568251511

runner = <click.testing.CliRunner object at 0x7fb65f97a550>
    def test_cli(runner):
        result = runner.invoke(cli)
>       assert result.output == TEST_CLI
E       AssertionError: assert 'Usage: cli [... ship (boat)\n' == 'Usage: cli [O...ages ships.\n'
E         Skipping 116 identical leading characters in diff, use -v to show
E         - ine (bomb)
E         -   ship (boat)
E         + ine (bomb)  Manages mines.
E         +   ship (boat)  Manages ships.
tests/test_naval.py:88: AssertionError

________________________________ test_ship_help ________________________________
runner = <click.testing.CliRunner object at 0x7fb65f97b110>

    def test_ship_help(runner):
        for cmd in ['ship', 'boat']:
            result = runner.invoke(cli, [cmd])
>           assert result.output == TEST_SHIP_HELP.format(cmd=cmd)
E           AssertionError: assert 'Usage: cli s...shoot (fire)\n' == 'Usage: cli sh...ire to X,Y.\n'
E             Skipping 134 identical leading characters in diff, use -v to show
E             - ,navigate)
E             -   new (add,build,create)
E             -   shoot (fire)
E             + ,navigate)   Moves SHIP to the new location X,Y.
E             +   new (add,build,create)  Creates a new ship.
E             +   shoot (fire)            Makes SHIP fire to X,Y.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.