diff options
author | Scott Moser <smoser@brickies.net> | 2016-08-23 16:48:43 -0400 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2016-08-23 16:48:43 -0400 |
commit | c00558f3159e0d1c54df3afa16ad8e06db6e30ab (patch) | |
tree | 7450e4d94477db02910da4d5118521904c3a89e2 /tests/unittests/helpers.py | |
parent | 90ad4618fd49dae5e833d6ab4d16495911cd5cde (diff) | |
parent | d86e75313524298e52469d4e55fa945ec731e938 (diff) | |
download | vyos-cloud-init-c00558f3159e0d1c54df3afa16ad8e06db6e30ab.tar.gz vyos-cloud-init-c00558f3159e0d1c54df3afa16ad8e06db6e30ab.zip |
merge trunk at 0.7.7~bzr1256
Diffstat (limited to 'tests/unittests/helpers.py')
-rw-r--r-- | tests/unittests/helpers.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/unittests/helpers.py b/tests/unittests/helpers.py index 8d46a8bf..972245df 100644 --- a/tests/unittests/helpers.py +++ b/tests/unittests/helpers.py @@ -264,6 +264,18 @@ def populate_dir(path, files): fp.close() +def dir2dict(startdir, prefix=None): + flist = {} + if prefix is None: + prefix = startdir + for root, dirs, files in os.walk(startdir): + for fname in files: + fpath = os.path.join(root, fname) + key = fpath[len(prefix):] + flist[key] = util.load_file(fpath) + return flist + + try: skipIf = unittest.skipIf except AttributeError: |