summaryrefslogtreecommitdiff
path: root/tests/unittests/helpers.py
diff options
context:
space:
mode:
authorScott Moser <smoser@brickies.net>2017-05-16 13:43:55 -0400
committerScott Moser <smoser@brickies.net>2017-05-16 15:34:21 -0400
commit4bcc947301bedc5ebf430cfaf6e4597bfb174aa7 (patch)
tree166aacb426f156147d5e8f7cc693c1b99e8c3861 /tests/unittests/helpers.py
parent9d437489b8ce1f8cd9d34cd9ff4994ca18bd2d78 (diff)
downloadvyos-cloud-init-4bcc947301bedc5ebf430cfaf6e4597bfb174aa7.tar.gz
vyos-cloud-init-4bcc947301bedc5ebf430cfaf6e4597bfb174aa7.zip
Improve detection of snappy to include os-release and kernel cmdline.
Recent core snap images (edge channel revision 1886) do not contain the previously known files used to detect that a system is ubuntu core. The changes here are to look in 2 additional locations to determine if a system is snappy. LP: #1689944
Diffstat (limited to 'tests/unittests/helpers.py')
-rw-r--r--tests/unittests/helpers.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/tests/unittests/helpers.py b/tests/unittests/helpers.py
index a711404c..d24f817d 100644
--- a/tests/unittests/helpers.py
+++ b/tests/unittests/helpers.py
@@ -106,7 +106,7 @@ class CiTestCase(TestCase):
return os.path.normpath(os.path.abspath(os.path.join(dir, path)))
-class ResourceUsingTestCase(TestCase):
+class ResourceUsingTestCase(CiTestCase):
def setUp(self):
super(ResourceUsingTestCase, self).setUp()
self.resource_path = None
@@ -229,8 +229,7 @@ class FilesystemMockingTestCase(ResourceUsingTestCase):
def reRoot(self, root=None):
if root is None:
- root = tempfile.mkdtemp()
- self.addCleanup(shutil.rmtree, root)
+ root = self.tmp_dir()
self.patchUtils(root)
self.patchOS(root)
return root
@@ -256,7 +255,7 @@ def populate_dir(path, files):
os.makedirs(path)
ret = []
for (name, content) in files.items():
- p = os.path.join(path, name)
+ p = os.path.sep.join([path, name])
util.ensure_dir(os.path.dirname(p))
with open(p, "wb") as fp:
if isinstance(content, six.binary_type):