pmbootstrap-meow/test/parse/test_arguments.py
Pablo Correa Gómez 7d36c604f1
test: add small test for argument parsing
This is just a small detail, but in some way CLI options are similar
to public API. I did this while trying some changes, even if in the
end the issue to solve was not in pmbootstrap, I thought it'd make
sense to contribute this.

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2626
2025-06-15 10:25:30 +02:00

19 lines
510 B
Python

# Copyright 2025 Pablo Correa Gomez
# SPDX-License-Identifier: GPL-3.0-or-later
from pmb.parse import get_parser
def test_chroot_simple():
parser = get_parser()
args = parser.parse_args("chroot ls".split())
assert args.action == "chroot"
assert args.command == ["ls"]
def test_chroot_args():
parser = get_parser()
args = parser.parse_args("chroot --rootfs -- ls -l".split())
assert args.action == "chroot"
assert args.rootfs is True
assert args.command == ["ls", "-l"]