Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make command line deprecation warnings visible with test profile #3665

Merged
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
6 changes: 0 additions & 6 deletions aiida/backends/tests/cmdline/commands/test_comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ def setUp(self):
self.cli_runner = CliRunner()
self.node = orm.Data().store()

def test_comment_show_simple(self):
"""Test simply calling the show command (without data to show)."""
result = self.cli_runner.invoke(cmd_comment.show, [], catch_exceptions=False)
self.assertEqual(result.output, '')
self.assertEqual(result.exit_code, 0)

def test_comment_show(self):
"""Test showing an existing comment."""
self.node.add_comment(COMMENT)
Expand Down
4 changes: 2 additions & 2 deletions aiida/cmdline/commands/cmd_devel.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ def devel_validate_plugins():
@verdi_devel.command('tests')
@click.argument('paths', nargs=-1, type=TestModuleParamType(), required=False)
@options.VERBOSE(help='Print the class and function name for each test.')
@decorators.deprecated_command("This command will be removed in aiida-core v2.0.0. Please run 'pytest' instead.")
@decorators.deprecated_command("This command has been removed in aiida-core v1.1.0. Please run 'pytest' instead.")
@decorators.with_dbenv()
def devel_tests(paths, verbose): # pylint: disable=unused-argument
"""Run the unittest suite or parts of it.

.. deprecated:: 1.1.0
Will be removed in `v2.0.0`.
Entry point will be completely removed in `v2.0.0`.
"""


Expand Down
10 changes: 3 additions & 7 deletions aiida/cmdline/utils/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,11 @@ def mycommand():
def wrapper(wrapped, _, args, kwargs):
"""Echo a deprecation warning before doing anything else."""
from aiida.cmdline.utils import templates
from aiida.manage.configuration import get_config
from textwrap import wrap

profile = get_config().current_profile

if not profile.is_test_profile:
template = templates.env.get_template('deprecated.tpl')
width = 80
echo.echo(template.render(msg=wrap(message, width - 4), width=width))
template = templates.env.get_template('deprecated.tpl')
width = 80
echo.echo(template.render(msg=wrap(message, width - 4), width=width))

return wrapped(*args, **kwargs)

Expand Down