Enable the bad-indentation pylint rule and fix space indentations (#2968)

This commit is contained in:
correctmost 2024-11-30 06:54:53 -05:00 committed by GitHub
parent 1e6492d34a
commit 11f8490b59
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 146 additions and 146 deletions

View File

@ -149,6 +149,7 @@ py-version = "3.12"
recursive = true recursive = true
[tool.pylint.format] [tool.pylint.format]
indent-string = '\t'
max-line-length = 160 max-line-length = 160
[tool.pylint."messages control"] [tool.pylint."messages control"]
@ -156,7 +157,6 @@ disable = [
"C", "C",
"R", "R",
"attribute-defined-outside-init", "attribute-defined-outside-init",
"bad-indentation",
"bare-except", "bare-except",
"broad-exception-caught", "broad-exception-caught",
"cell-var-from-loop", "cell-var-from-loop",

View File

@ -5,9 +5,9 @@ import pytest
@pytest.fixture(scope='session') @pytest.fixture(scope='session')
def config_fixture() -> Path: def config_fixture() -> Path:
return Path(__file__).parent / 'data' / 'test_config.json' return Path(__file__).parent / 'data' / 'test_config.json'
@pytest.fixture(scope='session') @pytest.fixture(scope='session')
def creds_fixture() -> Path: def creds_fixture() -> Path:
return Path(__file__).parent / 'data' / 'test_creds.json' return Path(__file__).parent / 'data' / 'test_creds.json'

View File

@ -17,159 +17,159 @@ from archinstall.lib.translationhandler import translation_handler
def test_default_args(monkeypatch: MonkeyPatch) -> None: def test_default_args(monkeypatch: MonkeyPatch) -> None:
monkeypatch.setattr('sys.argv', ['archinstall']) monkeypatch.setattr('sys.argv', ['archinstall'])
handler = ArchConfigHandler() handler = ArchConfigHandler()
args = handler.args args = handler.args
assert args == Arguments( assert args == Arguments(
config=None, config=None,
config_url=None, config_url=None,
creds=None, creds=None,
silent=False, silent=False,
dry_run=False, dry_run=False,
script='guided', script='guided',
mount_point=Path('/mnt'), mount_point=Path('/mnt'),
skip_ntp=False, skip_ntp=False,
debug=False, debug=False,
offline=False, offline=False,
no_pkg_lookups=False, no_pkg_lookups=False,
plugin=None, plugin=None,
skip_version_check=False, skip_version_check=False,
advanced=False advanced=False
) )
def test_correct_parsing_args( def test_correct_parsing_args(
monkeypatch: MonkeyPatch, monkeypatch: MonkeyPatch,
config_fixture: Path, config_fixture: Path,
creds_fixture: Path creds_fixture: Path
) -> None: ) -> None:
monkeypatch.setattr('sys.argv', [ monkeypatch.setattr('sys.argv', [
'archinstall', 'archinstall',
'--config', '--config',
str(config_fixture), str(config_fixture),
'--config-url', '--config-url',
'https://example.com', 'https://example.com',
'--creds', '--creds',
str(creds_fixture), str(creds_fixture),
'--script', '--script',
'execution_script', 'execution_script',
'--mount-point', '--mount-point',
'/tmp', '/tmp',
'--skip-ntp', '--skip-ntp',
'--debug', '--debug',
'--offline', '--offline',
'--no-pkg-lookups', '--no-pkg-lookups',
'--plugin', '--plugin',
'pytest_plugin.py', 'pytest_plugin.py',
'--skip-version-check', '--skip-version-check',
'--advanced', '--advanced',
'--dry-run', '--dry-run',
'--silent' '--silent'
]) ])
handler = ArchConfigHandler() handler = ArchConfigHandler()
args = handler.args args = handler.args
assert args == Arguments( assert args == Arguments(
config=config_fixture, config=config_fixture,
config_url='https://example.com', config_url='https://example.com',
creds=creds_fixture, creds=creds_fixture,
silent=True, silent=True,
dry_run=True, dry_run=True,
script='execution_script', script='execution_script',
mount_point=Path('/tmp'), mount_point=Path('/tmp'),
skip_ntp=True, skip_ntp=True,
debug=True, debug=True,
offline=True, offline=True,
no_pkg_lookups=True, no_pkg_lookups=True,
plugin='pytest_plugin.py', plugin='pytest_plugin.py',
skip_version_check=True, skip_version_check=True,
advanced=True advanced=True
) )
def test_config_file_parsing( def test_config_file_parsing(
monkeypatch: MonkeyPatch, monkeypatch: MonkeyPatch,
config_fixture: Path, config_fixture: Path,
creds_fixture: Path creds_fixture: Path
) -> None: ) -> None:
monkeypatch.setattr('sys.argv', [ monkeypatch.setattr('sys.argv', [
'archinstall', 'archinstall',
'--config', '--config',
str(config_fixture), str(config_fixture),
'--creds', '--creds',
str(creds_fixture), str(creds_fixture),
]) ])
handler = ArchConfigHandler() handler = ArchConfigHandler()
arch_config = handler.arch_config arch_config = handler.arch_config
# TODO: Use the real values from the test fixture instead of clearing out the entries # 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] arch_config.disk_config.device_modifications = [] # type: ignore[union-attr]
assert arch_config == ArchConfig( assert arch_config == ArchConfig(
version=archinstall.__version__, version=archinstall.__version__,
locale_config=LocaleConfiguration( locale_config=LocaleConfiguration(
kb_layout='us', kb_layout='us',
sys_lang='en_US', sys_lang='en_US',
sys_enc='UTF-8' sys_enc='UTF-8'
), ),
archinstall_language=translation_handler.get_language_by_abbr('en'), archinstall_language=translation_handler.get_language_by_abbr('en'),
disk_config=DiskLayoutConfiguration( disk_config=DiskLayoutConfiguration(
config_type=DiskLayoutType.Default, config_type=DiskLayoutType.Default,
device_modifications=[], device_modifications=[],
lvm_config=None, lvm_config=None,
mountpoint=None mountpoint=None
), ),
profile_config=ProfileConfiguration( profile_config=ProfileConfiguration(
profile=profile_handler.parse_profile_config({ profile=profile_handler.parse_profile_config({
"custom_settings": { "custom_settings": {
"Hyprland": { "Hyprland": {
"seat_access": "polkit" "seat_access": "polkit"
}, },
"Sway": { "Sway": {
"seat_access": "seatd" "seat_access": "seatd"
} }
}, },
"details": [ "details": [
"Sway", "Sway",
"Hyprland" "Hyprland"
], ],
"main": "Desktop" "main": "Desktop"
}), }),
gfx_driver=GfxDriver.AllOpenSource, gfx_driver=GfxDriver.AllOpenSource,
greeter=GreeterType.Lightdm greeter=GreeterType.Lightdm
), ),
mirror_config=MirrorConfiguration( mirror_config=MirrorConfiguration(
mirror_regions={}, mirror_regions={},
custom_mirrors=[] custom_mirrors=[]
), ),
network_config=NetworkConfiguration( network_config=NetworkConfiguration(
type=NicType.MANUAL, type=NicType.MANUAL,
nics=[ nics=[
Nic( Nic(
iface='eno1', iface='eno1',
ip='192.168.1.15/24', ip='192.168.1.15/24',
dhcp=True, dhcp=True,
gateway='192.168.1.1', gateway='192.168.1.1',
dns=[ dns=[
'192.168.1.1', '192.168.1.1',
'9.9.9.9' '9.9.9.9'
] ]
) )
] ]
), ),
bootloader=Bootloader.Systemd, bootloader=Bootloader.Systemd,
uki=False, uki=False,
audio_config=AudioConfiguration(Audio.Pipewire), audio_config=AudioConfiguration(Audio.Pipewire),
hostname='archy', hostname='archy',
kernels=['linux-zen'], kernels=['linux-zen'],
ntp=True, ntp=True,
packages=["firefox"], packages=["firefox"],
parallel_downloads=66, parallel_downloads=66,
swap=False, swap=False,
timezone='UTC', timezone='UTC',
additional_repositories=["testing"], additional_repositories=["testing"],
_users=[User(username='user_name', password='user_pwd', sudo=True)], _users=[User(username='user_name', password='user_pwd', sudo=True)],
_disk_encryption=None _disk_encryption=None
) )