Enable pytest test runs on CI (#2947)

This commit also fixes fixture and test issues that caused failures.
This commit is contained in:
correctmost 2024-11-27 01:42:22 -05:00 committed by GitHub
parent a28fb27a7a
commit e49a679fb8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 43 additions and 12 deletions

View File

@ -8,8 +8,14 @@ jobs:
options: --privileged options: --privileged
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- run: pacman --noconfirm -Syu python python-pip qemu gcc - name: Prepare arch
- run: python -m pip install --break-system-packages --upgrade pip run: |
- run: pip install --break-system-packages pytest pacman-key --init
pacman --noconfirm -Sy archlinux-keyring
pacman --noconfirm -Syyu
pacman --noconfirm -Sy python-pip python-pyparted pkgconfig gcc
- run: pip install --break-system-packages --upgrade pip
- name: Install archinstall dependencies
run: pip install --break-system-packages .[dev]
- name: Test with pytest - name: Test with pytest
run: python -m pytest || exit 0 run: pytest

View File

@ -11,12 +11,16 @@
"partitions": [ "partitions": [
{ {
"btrfs": [], "btrfs": [],
"dev_path": null,
"flags": [ "flags": [
"boot" "boot"
], ],
"fs_type": "fat32", "fs_type": "fat32",
"size": { "size": {
"sector_size": null, "sector_size": {
"unit": "B",
"value": 512
},
"unit": "MiB", "unit": "MiB",
"value": 512 "value": 512
}, },
@ -24,7 +28,10 @@
"mountpoint": "/boot", "mountpoint": "/boot",
"obj_id": "2c3fa2d5-2c79-4fab-86ec-22d0ea1543c0", "obj_id": "2c3fa2d5-2c79-4fab-86ec-22d0ea1543c0",
"start": { "start": {
"sector_size": null, "sector_size": {
"unit": "B",
"value": 512
},
"unit": "MiB", "unit": "MiB",
"value": 1 "value": 1
}, },
@ -33,10 +40,14 @@
}, },
{ {
"btrfs": [], "btrfs": [],
"dev_path": null,
"flags": [], "flags": [],
"fs_type": "ext4", "fs_type": "ext4",
"size": { "size": {
"sector_size": null, "sector_size": {
"unit": "B",
"value": 512
},
"unit": "GiB", "unit": "GiB",
"value": 20 "value": 20
}, },
@ -44,7 +55,10 @@
"mountpoint": "/", "mountpoint": "/",
"obj_id": "3e7018a0-363b-4d05-ab83-8e82d13db208", "obj_id": "3e7018a0-363b-4d05-ab83-8e82d13db208",
"start": { "start": {
"sector_size": null, "sector_size": {
"unit": "B",
"value": 512
},
"unit": "MiB", "unit": "MiB",
"value": 513 "value": 513
}, },
@ -53,18 +67,25 @@
}, },
{ {
"btrfs": [], "btrfs": [],
"dev_path": null,
"flags": [], "flags": [],
"fs_type": "ext4", "fs_type": "ext4",
"size": { "size": {
"sector_size": null, "sector_size": {
"unit": "Percent", "unit": "B",
"value": 512
},
"unit": "GiB",
"value": 100 "value": 100
}, },
"mount_options": [], "mount_options": [],
"mountpoint": "/home", "mountpoint": "/home",
"obj_id": "ce58b139-f041-4a06-94da-1f8bad775d3f", "obj_id": "ce58b139-f041-4a06-94da-1f8bad775d3f",
"start": { "start": {
"sector_size": null, "sector_size": {
"unit": "B",
"value": 512
},
"unit": "GiB", "unit": "GiB",
"value": 20 "value": 20
}, },

View File

@ -2,6 +2,7 @@ from pathlib import Path
from pytest import MonkeyPatch from pytest import MonkeyPatch
import archinstall
from archinstall.default_profiles.profile import GreeterType from archinstall.default_profiles.profile import GreeterType
from archinstall.lib.args import ArchConfig, ArchConfigHandler, Arguments from archinstall.lib.args import ArchConfig, ArchConfigHandler, Arguments
from archinstall.lib.disk import DiskLayoutConfiguration, DiskLayoutType from archinstall.lib.disk import DiskLayoutConfiguration, DiskLayoutType
@ -103,8 +104,11 @@ def test_config_file_parsing(
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
arch_config.disk_config.device_modifications = []
assert arch_config == ArchConfig( assert arch_config == ArchConfig(
version='3.0.0', version=archinstall.__version__,
locale_config=LocaleConfiguration( locale_config=LocaleConfiguration(
kb_layout='us', kb_layout='us',
sys_lang='en_US', sys_lang='en_US',