# The solution with runpy gives a dictionary, which isn't great, but will do.
ukify = runpy.run_path(UKIFY, run_name='ukify')
- # Create "empty" namespace. We want to override just a few settings,
- # so it doesn't make sense to duplicate all the fields. We use a hack
- # to pre-populate the namespace like argparse would, all defaults.
- # We need to specify the two mandatory arguments to not get an error.
- opts2 = ukify['create_parser']().parse_args(('A','B'))
+ # Create "empty" namespace. We want to override just a few settings, so it
+ # doesn't make sense to configure everything. We pretend to parse an empty
+ # argument set to prepopulate the namespace with the defaults.
+ opts2 = ukify['create_parser']().parse_args(())
opts2.config = config_file_location()
opts2.uname = opts.kernel_version
assert ukify.round_up(4097) == 8192
def test_namespace_creation():
- ns = ukify.create_parser().parse_args(('A','B'))
- assert ns.linux == pathlib.Path('A')
- assert ns.initrd == [pathlib.Path('B')]
+ ns = ukify.create_parser().parse_args(())
+ assert ns.linux is None
+ assert ns.initrd == []
def test_config_example():
ex = ukify.config_example()
Phases = {':'.join(ukify.KNOWN_PHASES)}
'''))
- ns = ukify.create_parser().parse_args(('A','B'))
+ ns = ukify.create_parser().parse_args(())
ns.linux = None
ns.initrd = []
ukify.apply_config(ns, config)