diff options
author | Scott Moser <smoser@brickies.net> | 2016-10-20 22:53:17 -0400 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2017-01-11 14:19:35 -0500 |
commit | a1b185d0cce5064e9b36b4db7b55564e2ab1d7a8 (patch) | |
tree | d3f0382f70faaa4803ee1fc9b43a6990beaf465c /tests/unittests/helpers.py | |
parent | 7fb6f78177b5ece10ca7c54ba3958010a9987f06 (diff) | |
download | vyos-cloud-init-a1b185d0cce5064e9b36b4db7b55564e2ab1d7a8.tar.gz vyos-cloud-init-a1b185d0cce5064e9b36b4db7b55564e2ab1d7a8.zip |
Get early logging logged, including failures of cmdline url.
Failures to load the kernel command line's url (cloud-config-url=)
would previously get swallowed. This should make it much more
obvious when that happens. With logging going to expected places
at sane levels (WARN will go to stderr by default).
Diffstat (limited to 'tests/unittests/helpers.py')
-rw-r--r-- | tests/unittests/helpers.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/unittests/helpers.py b/tests/unittests/helpers.py index cf3b46d2..64e56d98 100644 --- a/tests/unittests/helpers.py +++ b/tests/unittests/helpers.py @@ -264,16 +264,22 @@ class HttprettyTestCase(TestCase): class TempDirTestCase(TestCase): # provide a tempdir per class, not per test. - def setUp(self): - super(TempDirTestCase, self).setUp() - self.tmp = tempfile.mkdtemp() - self.addCleanup(shutil.rmtree, self.tmp) + @classmethod + def setUpClass(cls): + cls.tmpd = tempfile.mkdtemp(prefix="ci-%s." % cls.__name__) + return TestCase.setUpClass() + + @classmethod + def tearDownClass(cls): + shutil.rmtree(cls.tmpd) + return TestCase.tearDownClass() def tmp_path(self, path): + # if absolute path (starts with /), then make ./path if path.startswith(os.path.sep): path = "." + path - return os.path.normpath(os.path.join(self.tmp, path)) + return os.path.normpath(os.path.join(self.tmpd, path)) def populate_dir(path, files): |