From 5f256b9e4afc7c7a604c8c240033ab8eba2b6467 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 17 Nov 2019 13:56:18 +0000 Subject: Added tests. Also improved emulated commands. --- test_archinstall.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 test_archinstall.py (limited to 'test_archinstall.py') diff --git a/test_archinstall.py b/test_archinstall.py new file mode 100644 index 00000000..3b5ddcae --- /dev/null +++ b/test_archinstall.py @@ -0,0 +1,13 @@ +import json +import archinstall + +archinstall.update_drive_list(emulate=False) +archinstall.setup_args_defaults(archinstall.args, interactive=False) +#for drive in archinstall.harddrives: +# print(drive, archinstall.human_disk_info(drive)) + +instructions = archinstall.load_automatic_instructions(emulate=False) +profile_instructions = archinstall.get_instructions('workstation', emulate=False) +profile_instructions = archinstall.merge_in_includes(profile_instructions, emulate=False) + +print(json.dumps(archinstall.args, indent=4)) \ No newline at end of file -- cgit v1.2.3-70-g09d2 From 9cd0a4b73f4d284e1991360f316a1053a234f232 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 17 Nov 2019 23:06:09 +0000 Subject: Fixed some stuff --- archinstall.py | 7 +++++-- test_archinstall.py | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'test_archinstall.py') diff --git a/archinstall.py b/archinstall.py index 5c261662..e43109b4 100644 --- a/archinstall.py +++ b/archinstall.py @@ -216,7 +216,7 @@ class sys_command():#Thread): if not 'emulate' in kwargs: kwargs['emulate'] = SAFETY_LOCK #Thread.__init__(self) if kwargs['emulate']: - print('Starting command in emulation mode.') + print(f"Starting command '{cmd}' in emulation mode.") self.cmd = shlex.split(cmd) self.args = args self.kwargs = kwargs @@ -494,7 +494,10 @@ def get_disk_size(drive): return ''.join(human_readable_size(fh.read().decode('UTF-8').strip())) def disk_info(drive, *positionals, **kwargs): - info = json.loads(b''.join(sys_command(f'lsblk -J -o "NAME,SIZE,FSTYPE,LABEL" {drive}', *positionals, **kwargs)).decode('UTF_8'))['blockdevices'][0] + lkwargs = {**kwargs} + lkwargs['emulate'] = False # This is a emulate-safe function. Does not alter filesystem. + + info = json.loads(b''.join(sys_command(f'lsblk -J -o "NAME,SIZE,FSTYPE,LABEL" {drive}', *positionals, **lkwargs)).decode('UTF_8'))['blockdevices'][0] fileformats = [] labels = [] for child in info['children']: diff --git a/test_archinstall.py b/test_archinstall.py index 3b5ddcae..30bc76e7 100644 --- a/test_archinstall.py +++ b/test_archinstall.py @@ -9,5 +9,6 @@ archinstall.setup_args_defaults(archinstall.args, interactive=False) instructions = archinstall.load_automatic_instructions(emulate=False) profile_instructions = archinstall.get_instructions('workstation', emulate=False) profile_instructions = archinstall.merge_in_includes(profile_instructions, emulate=False) +archinstall.args['password'] = 'test' print(json.dumps(archinstall.args, indent=4)) \ No newline at end of file -- cgit v1.2.3-70-g09d2