From 11f8490b5927cb62f79a18217313c17ca2df0f59 Mon Sep 17 00:00:00 2001 From: correctmost <134317971+correctmost@users.noreply.github.com> Date: Sat, 30 Nov 2024 06:54:53 -0500 Subject: [PATCH] Enable the bad-indentation pylint rule and fix space indentations (#2968) --- pyproject.toml | 2 +- tests/conftest.py | 4 +- tests/test_args.py | 286 ++++++++++++++++++++++----------------------- 3 files changed, 146 insertions(+), 146 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index cfd189e4..60e4af67 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -149,6 +149,7 @@ py-version = "3.12" recursive = true [tool.pylint.format] +indent-string = '\t' max-line-length = 160 [tool.pylint."messages control"] @@ -156,7 +157,6 @@ disable = [ "C", "R", "attribute-defined-outside-init", - "bad-indentation", "bare-except", "broad-exception-caught", "cell-var-from-loop", diff --git a/tests/conftest.py b/tests/conftest.py index 6c63cb12..f0cabfca 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -5,9 +5,9 @@ import pytest @pytest.fixture(scope='session') def config_fixture() -> Path: - return Path(__file__).parent / 'data' / 'test_config.json' + return Path(__file__).parent / 'data' / 'test_config.json' @pytest.fixture(scope='session') def creds_fixture() -> Path: - return Path(__file__).parent / 'data' / 'test_creds.json' + return Path(__file__).parent / 'data' / 'test_creds.json' diff --git a/tests/test_args.py b/tests/test_args.py index 77173c09..6b9e9736 100644 --- a/tests/test_args.py +++ b/tests/test_args.py @@ -17,159 +17,159 @@ from archinstall.lib.translationhandler import translation_handler def test_default_args(monkeypatch: MonkeyPatch) -> None: - monkeypatch.setattr('sys.argv', ['archinstall']) - handler = ArchConfigHandler() - args = handler.args - assert args == Arguments( - config=None, - config_url=None, - creds=None, - silent=False, - dry_run=False, - script='guided', - mount_point=Path('/mnt'), - skip_ntp=False, - debug=False, - offline=False, - no_pkg_lookups=False, - plugin=None, - skip_version_check=False, - advanced=False - ) + monkeypatch.setattr('sys.argv', ['archinstall']) + handler = ArchConfigHandler() + args = handler.args + assert args == Arguments( + config=None, + config_url=None, + creds=None, + silent=False, + dry_run=False, + script='guided', + mount_point=Path('/mnt'), + skip_ntp=False, + debug=False, + offline=False, + no_pkg_lookups=False, + plugin=None, + skip_version_check=False, + advanced=False + ) def test_correct_parsing_args( - monkeypatch: MonkeyPatch, - config_fixture: Path, - creds_fixture: Path + monkeypatch: MonkeyPatch, + config_fixture: Path, + creds_fixture: Path ) -> None: - monkeypatch.setattr('sys.argv', [ - 'archinstall', - '--config', - str(config_fixture), - '--config-url', - 'https://example.com', - '--creds', - str(creds_fixture), - '--script', - 'execution_script', - '--mount-point', - '/tmp', - '--skip-ntp', - '--debug', - '--offline', - '--no-pkg-lookups', - '--plugin', - 'pytest_plugin.py', - '--skip-version-check', - '--advanced', - '--dry-run', - '--silent' - ]) + monkeypatch.setattr('sys.argv', [ + 'archinstall', + '--config', + str(config_fixture), + '--config-url', + 'https://example.com', + '--creds', + str(creds_fixture), + '--script', + 'execution_script', + '--mount-point', + '/tmp', + '--skip-ntp', + '--debug', + '--offline', + '--no-pkg-lookups', + '--plugin', + 'pytest_plugin.py', + '--skip-version-check', + '--advanced', + '--dry-run', + '--silent' + ]) - handler = ArchConfigHandler() - args = handler.args + handler = ArchConfigHandler() + args = handler.args - assert args == Arguments( - config=config_fixture, - config_url='https://example.com', - creds=creds_fixture, - silent=True, - dry_run=True, - script='execution_script', - mount_point=Path('/tmp'), - skip_ntp=True, - debug=True, - offline=True, - no_pkg_lookups=True, - plugin='pytest_plugin.py', - skip_version_check=True, - advanced=True - ) + assert args == Arguments( + config=config_fixture, + config_url='https://example.com', + creds=creds_fixture, + silent=True, + dry_run=True, + script='execution_script', + mount_point=Path('/tmp'), + skip_ntp=True, + debug=True, + offline=True, + no_pkg_lookups=True, + plugin='pytest_plugin.py', + skip_version_check=True, + advanced=True + ) def test_config_file_parsing( - monkeypatch: MonkeyPatch, - config_fixture: Path, - creds_fixture: Path + monkeypatch: MonkeyPatch, + config_fixture: Path, + creds_fixture: Path ) -> None: - monkeypatch.setattr('sys.argv', [ - 'archinstall', - '--config', - str(config_fixture), - '--creds', - str(creds_fixture), - ]) + monkeypatch.setattr('sys.argv', [ + 'archinstall', + '--config', + str(config_fixture), + '--creds', + str(creds_fixture), + ]) - handler = ArchConfigHandler() - arch_config = handler.arch_config + handler = ArchConfigHandler() + arch_config = handler.arch_config - # TODO: Use the real values from the test fixture instead of clearing out the entries - arch_config.disk_config.device_modifications = [] # type: ignore[union-attr] + # TODO: Use the real values from the test fixture instead of clearing out the entries + arch_config.disk_config.device_modifications = [] # type: ignore[union-attr] - assert arch_config == ArchConfig( - version=archinstall.__version__, - locale_config=LocaleConfiguration( - kb_layout='us', - sys_lang='en_US', - sys_enc='UTF-8' - ), - archinstall_language=translation_handler.get_language_by_abbr('en'), - disk_config=DiskLayoutConfiguration( - config_type=DiskLayoutType.Default, - device_modifications=[], - lvm_config=None, - mountpoint=None - ), - profile_config=ProfileConfiguration( - profile=profile_handler.parse_profile_config({ - "custom_settings": { - "Hyprland": { - "seat_access": "polkit" - }, - "Sway": { - "seat_access": "seatd" - } - }, - "details": [ - "Sway", - "Hyprland" - ], - "main": "Desktop" - }), - gfx_driver=GfxDriver.AllOpenSource, - greeter=GreeterType.Lightdm - ), - mirror_config=MirrorConfiguration( - mirror_regions={}, - custom_mirrors=[] - ), - network_config=NetworkConfiguration( - type=NicType.MANUAL, - nics=[ - Nic( - iface='eno1', - ip='192.168.1.15/24', - dhcp=True, - gateway='192.168.1.1', - dns=[ - '192.168.1.1', - '9.9.9.9' - ] - ) - ] - ), - bootloader=Bootloader.Systemd, - uki=False, - audio_config=AudioConfiguration(Audio.Pipewire), - hostname='archy', - kernels=['linux-zen'], - ntp=True, - packages=["firefox"], - parallel_downloads=66, - swap=False, - timezone='UTC', - additional_repositories=["testing"], - _users=[User(username='user_name', password='user_pwd', sudo=True)], - _disk_encryption=None - ) + assert arch_config == ArchConfig( + version=archinstall.__version__, + locale_config=LocaleConfiguration( + kb_layout='us', + sys_lang='en_US', + sys_enc='UTF-8' + ), + archinstall_language=translation_handler.get_language_by_abbr('en'), + disk_config=DiskLayoutConfiguration( + config_type=DiskLayoutType.Default, + device_modifications=[], + lvm_config=None, + mountpoint=None + ), + profile_config=ProfileConfiguration( + profile=profile_handler.parse_profile_config({ + "custom_settings": { + "Hyprland": { + "seat_access": "polkit" + }, + "Sway": { + "seat_access": "seatd" + } + }, + "details": [ + "Sway", + "Hyprland" + ], + "main": "Desktop" + }), + gfx_driver=GfxDriver.AllOpenSource, + greeter=GreeterType.Lightdm + ), + mirror_config=MirrorConfiguration( + mirror_regions={}, + custom_mirrors=[] + ), + network_config=NetworkConfiguration( + type=NicType.MANUAL, + nics=[ + Nic( + iface='eno1', + ip='192.168.1.15/24', + dhcp=True, + gateway='192.168.1.1', + dns=[ + '192.168.1.1', + '9.9.9.9' + ] + ) + ] + ), + bootloader=Bootloader.Systemd, + uki=False, + audio_config=AudioConfiguration(Audio.Pipewire), + hostname='archy', + kernels=['linux-zen'], + ntp=True, + packages=["firefox"], + parallel_downloads=66, + swap=False, + timezone='UTC', + additional_repositories=["testing"], + _users=[User(username='user_name', password='user_pwd', sudo=True)], + _disk_encryption=None + )