diff --git a/.travis.yml b/.travis.yml index d837eb0..870bcd4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,10 +22,10 @@ env: - TOXENV=pypy-dj18 - TOXENV=pypy-dj110 - TOXENV=py27-dj111 - - TOXENV=py34-dj111 - - TOXENV=py35-dj111 - - TOXENV=py36-dj111 - - TOXENV=pypy-dj111 + - TOXENV=py34-dj20 + - TOXENV=py35-dj20 + - TOXENV=py36-dj20 + - TOXENV=pypy-dj20 - TOXENV=flake8 cache: diff --git a/LICENSE b/LICENSE index e0c4c5f..b493d96 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2015 Jonathan Stoppani +Copyright (c) 2015-2017 Jonathan Stoppani Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/djclick/adapter.py b/djclick/adapter.py index eac378a..b9089a8 100644 --- a/djclick/adapter.py +++ b/djclick/adapter.py @@ -35,6 +35,14 @@ def parse_args(self, args): class DjangoCommandMixin(object): use_argparse = False option_list = [] + base_stealth_options = [] + + @property + def stealth_options(self): + return sum( + ([p.name] + [i.lstrip('-') for i in p.opts] for p in self.params), + [], + ) def invoke(self, ctx): try: diff --git a/djclick/test/test_adapter.py b/djclick/test/test_adapter.py index f68d2ed..0bb68d1 100644 --- a/djclick/test/test_adapter.py +++ b/djclick/test/test_adapter.py @@ -56,6 +56,8 @@ def test_call_cli(): def test_call_command_args(): call_command('testcmd') + with pytest.raises(RuntimeError): + call_command('testcmd', '-r') with pytest.raises(RuntimeError): call_command('testcmd', '--raise') @@ -219,12 +221,8 @@ def test_django_help(manage): def test_django_version(manage): django_version = django.get_version().encode('ascii') + b'\n' - if django.VERSION < (1, 8): - prefix = django_version - else: - prefix = b'' - assert manage('testcmd', '--version') == prefix + django_version - assert manage('versioncmd', '--version') == prefix + b'20.0\n' + assert manage('testcmd', '--version') == django_version + assert manage('versioncmd', '--version') == b'20.0\n' def test_group_command(capsys): diff --git a/djclick/test/testprj/testapp/management/commands/testcmd.py b/djclick/test/testprj/testapp/management/commands/testcmd.py index 052b6ca..a436012 100644 --- a/djclick/test/testprj/testapp/management/commands/testcmd.py +++ b/djclick/test/testprj/testapp/management/commands/testcmd.py @@ -2,7 +2,7 @@ @click.command() -@click.option('--raise', 'raise_when_called', is_flag=True) +@click.option('-r', '--raise', 'raise_when_called', is_flag=True) def command(raise_when_called): if raise_when_called: raise RuntimeError() diff --git a/tox.ini b/tox.ini index e7c9f48..6c7bd84 100644 --- a/tox.ini +++ b/tox.ini @@ -7,6 +7,7 @@ envlist = coverage_erase, py{27,34,35,py}-dj{18,110}, py{27,34,35,36,py}-dj{111}, + py{34,35,36,py}-dj{20}, flake8, coverage_report @@ -21,6 +22,7 @@ deps = dj18: django>=1.8,<1.9 dj110: django>=1.10,<1.11 dj111: django>=1.11,<1.12 + dj20: django>=2.0,<2.1 commands = py.test -rxs --cov-report= --cov-append --cov djclick {posargs:djclick} [testenv:coverage_erase]