From 5cf90279221e4dab193830d40224f163008db23f Mon Sep 17 00:00:00 2001 From: Ali Date: Thu, 23 May 2024 22:02:34 +0200 Subject: [PATCH] Apply review --- src/aiida/cmdline/commands/cmd_plugin.py | 2 +- tests/cmdline/commands/test_plugin.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/aiida/cmdline/commands/cmd_plugin.py b/src/aiida/cmdline/commands/cmd_plugin.py index 80dd6855ed..9f43dd8b56 100644 --- a/src/aiida/cmdline/commands/cmd_plugin.py +++ b/src/aiida/cmdline/commands/cmd_plugin.py @@ -49,7 +49,7 @@ def plugin_list(entry_point_group, entry_point): else: try: if (inspect.isclass(plugin) and issubclass(plugin, Process)) or ( - False if not hasattr(plugin, 'is_process_function') else plugin.is_process_function + hasattr(plugin, 'is_process_function') and plugin.is_process_function ): print_process_info(plugin) else: diff --git a/tests/cmdline/commands/test_plugin.py b/tests/cmdline/commands/test_plugin.py index c1ef90fe10..ec545ddea0 100644 --- a/tests/cmdline/commands/test_plugin.py +++ b/tests/cmdline/commands/test_plugin.py @@ -11,7 +11,7 @@ import pytest from aiida.cmdline.commands import cmd_plugin from aiida.parsers import Parser -from aiida.plugins import CalculationFactory, WorkflowFactory +from aiida.plugins import CalculationFactory, ParserFactory, WorkflowFactory from aiida.plugins.entry_point import ENTRY_POINT_GROUP_TO_MODULE_PATH_MAP @@ -66,11 +66,10 @@ def get_description(cls) -> str: def test_plugin_description(run_cli_command, entry_points): - """Test if `verdi plugin list` would show description of an external plugin.""" - from aiida.plugins import ParserFactory + """Test that ``verdi plugin list`` uses ``get_description`` if defined.""" entry_points.add(CustomParser, 'aiida.parsers:custom.parser') assert ParserFactory('custom.parser') is CustomParser result = run_cli_command(cmd_plugin.plugin_list, ['aiida.parsers', 'custom.parser']) - assert result.stdout_bytes.decode('utf-8').strip() == 'str69' + assert result.output.strip() == 'str69'