chore: add metthod definition order plugin to pylint

Also reorder some methods to fix errors
This commit is contained in:
2023-11-04 16:16:14 +02:00
parent 79947af013
commit c51463d36b
17 changed files with 323 additions and 150 deletions

View File

@ -104,36 +104,6 @@ def test_subparsers_aur_search_option_repository(parser: argparse.ArgumentParser
assert args.repository == ""
def test_subparsers_help(parser: argparse.ArgumentParser) -> None:
"""
help command must imply architecture list, lock, quiet, report, repository, unsafe and parser
"""
args = parser.parse_args(["help"])
assert args.architecture == ""
assert args.lock is None
assert args.quiet
assert not args.report
assert args.repository == ""
assert args.unsafe
assert args.parser is not None and args.parser()
def test_subparsers_help_option_architecture(parser: argparse.ArgumentParser) -> None:
"""
help command must correctly parse architecture list
"""
args = parser.parse_args(["-a", "x86_64", "help"])
assert args.architecture == ""
def test_subparsers_help_option_repository(parser: argparse.ArgumentParser) -> None:
"""
help command must correctly parse repository list
"""
args = parser.parse_args(["-r", "repo", "help"])
assert args.repository == ""
def test_subparsers_help_commands_unsafe(parser: argparse.ArgumentParser) -> None:
"""
help-commands-unsafe command must imply architecture list, lock, quiet, report, repository, unsafe and parser
@ -164,6 +134,36 @@ def test_subparsers_help_commands_unsafe_option_repository(parser: argparse.Argu
assert args.repository == ""
def test_subparsers_help(parser: argparse.ArgumentParser) -> None:
"""
help command must imply architecture list, lock, quiet, report, repository, unsafe and parser
"""
args = parser.parse_args(["help"])
assert args.architecture == ""
assert args.lock is None
assert args.quiet
assert not args.report
assert args.repository == ""
assert args.unsafe
assert args.parser is not None and args.parser()
def test_subparsers_help_option_architecture(parser: argparse.ArgumentParser) -> None:
"""
help command must correctly parse architecture list
"""
args = parser.parse_args(["-a", "x86_64", "help"])
assert args.architecture == ""
def test_subparsers_help_option_repository(parser: argparse.ArgumentParser) -> None:
"""
help command must correctly parse repository list
"""
args = parser.parse_args(["-r", "repo", "help"])
assert args.repository == ""
def test_subparsers_help_updates(parser: argparse.ArgumentParser) -> None:
"""
help-updates command must imply architecture list, lock, quiet, report, repository, and unsafe

View File

@ -30,30 +30,6 @@ def test_path(args: argparse.Namespace, configuration: Configuration) -> None:
Lock(args, repository_id, configuration).path # special case
def test_check_version(lock: Lock, mocker: MockerFixture) -> None:
"""
must check version correctly
"""
mocker.patch("ahriman.core.status.client.Client.status_get",
return_value=InternalStatus(status=BuildStatus(), version=__version__))
logging_mock = mocker.patch("logging.Logger.warning")
lock.check_version()
logging_mock.assert_not_called()
def test_check_version_mismatch(lock: Lock, mocker: MockerFixture) -> None:
"""
must check mismatched version correctly
"""
mocker.patch("ahriman.core.status.client.Client.status_get",
return_value=InternalStatus(status=BuildStatus(), version="version"))
logging_mock = mocker.patch("logging.Logger.warning")
lock.check_version()
logging_mock.assert_called_once() # we do not check logging arguments
def test_check_user(lock: Lock, mocker: MockerFixture) -> None:
"""
must check user correctly
@ -84,6 +60,30 @@ def test_check_user_unsafe(lock: Lock, mocker: MockerFixture) -> None:
lock.check_user()
def test_check_version(lock: Lock, mocker: MockerFixture) -> None:
"""
must check version correctly
"""
mocker.patch("ahriman.core.status.client.Client.status_get",
return_value=InternalStatus(status=BuildStatus(), version=__version__))
logging_mock = mocker.patch("logging.Logger.warning")
lock.check_version()
logging_mock.assert_not_called()
def test_check_version_mismatch(lock: Lock, mocker: MockerFixture) -> None:
"""
must check mismatched version correctly
"""
mocker.patch("ahriman.core.status.client.Client.status_get",
return_value=InternalStatus(status=BuildStatus(), version="version"))
logging_mock = mocker.patch("logging.Logger.warning")
lock.check_version()
logging_mock.assert_called_once() # we do not check logging arguments
def test_clear(lock: Lock) -> None:
"""
must remove lock file