Skip to content

Commit

Permalink
Enable pytest test runs on CI (archlinux#2947)
Browse files Browse the repository at this point in the history
This commit also fixes fixture and test issues that caused failures.
  • Loading branch information
correctmost authored and castillofrancodamian committed Dec 21, 2024
1 parent decd91e commit 8314789
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 12 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ jobs:
options: --privileged
steps:
- uses: actions/checkout@v4
- run: pacman --noconfirm -Syu python python-pip qemu gcc
- run: python -m pip install --break-system-packages --upgrade pip
- run: pip install --break-system-packages pytest
- name: Prepare arch
run: |
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
run: python -m pytest || exit 0
run: pytest
35 changes: 28 additions & 7 deletions tests/data/test_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,27 @@
"partitions": [
{
"btrfs": [],
"dev_path": null,
"flags": [
"boot"
],
"fs_type": "fat32",
"size": {
"sector_size": null,
"sector_size": {
"unit": "B",
"value": 512
},
"unit": "MiB",
"value": 512
},
"mount_options": [],
"mountpoint": "/boot",
"obj_id": "2c3fa2d5-2c79-4fab-86ec-22d0ea1543c0",
"start": {
"sector_size": null,
"sector_size": {
"unit": "B",
"value": 512
},
"unit": "MiB",
"value": 1
},
Expand All @@ -33,18 +40,25 @@
},
{
"btrfs": [],
"dev_path": null,
"flags": [],
"fs_type": "ext4",
"size": {
"sector_size": null,
"sector_size": {
"unit": "B",
"value": 512
},
"unit": "GiB",
"value": 20
},
"mount_options": [],
"mountpoint": "/",
"obj_id": "3e7018a0-363b-4d05-ab83-8e82d13db208",
"start": {
"sector_size": null,
"sector_size": {
"unit": "B",
"value": 512
},
"unit": "MiB",
"value": 513
},
Expand All @@ -53,18 +67,25 @@
},
{
"btrfs": [],
"dev_path": null,
"flags": [],
"fs_type": "ext4",
"size": {
"sector_size": null,
"unit": "Percent",
"sector_size": {
"unit": "B",
"value": 512
},
"unit": "GiB",
"value": 100
},
"mount_options": [],
"mountpoint": "/home",
"obj_id": "ce58b139-f041-4a06-94da-1f8bad775d3f",
"start": {
"sector_size": null,
"sector_size": {
"unit": "B",
"value": 512
},
"unit": "GiB",
"value": 20
},
Expand Down
6 changes: 5 additions & 1 deletion tests/test_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from pytest import MonkeyPatch

import archinstall
from archinstall.default_profiles.profile import GreeterType
from archinstall.lib.args import ArchConfig, ArchConfigHandler, Arguments
from archinstall.lib.disk import DiskLayoutConfiguration, DiskLayoutType
Expand Down Expand Up @@ -103,8 +104,11 @@ def test_config_file_parsing(
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 = []

assert arch_config == ArchConfig(
version='3.0.0',
version=archinstall.__version__,
locale_config=LocaleConfiguration(
kb_layout='us',
sys_lang='en_US',
Expand Down

0 comments on commit 8314789

Please sign in to comment.