forked from Mirror/pmbootstrap
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
This commit is contained in:
parent
ed396475f5
commit
7d36c604f1
1 changed files with 19 additions and 0 deletions
19
test/parse/test_arguments.py
Normal file
19
test/parse/test_arguments.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
# 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"]
|
Loading…
Add table
Add a link
Reference in a new issue