| #!/usr/bin/python |
| # Copyright 2017 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import os |
| import shutil |
| import tempfile |
| import unittest |
| |
| import common |
| from autotest_lib.site_utils import lxc |
| from autotest_lib.site_utils.lxc import unittest_setup |
| |
| |
| container_path = None |
| |
| def setUpModule(): |
| """Creates a directory for running the unit tests. """ |
| global container_path |
| container_path = tempfile.mkdtemp( |
| dir=lxc.DEFAULT_CONTAINER_PATH, |
| prefix='container_bucket_unittest_') |
| |
| |
| def tearDownModule(): |
| """Deletes the test directory. """ |
| shutil.rmtree(container_path) |
| |
| |
| class ContainerBucketTests(unittest.TestCase): |
| """Unit tests for the ContainerBucket class.""" |
| |
| def setUp(self): |
| self.tmpdir = tempfile.mkdtemp() |
| self.shared_host_path = os.path.realpath(os.path.join(self.tmpdir, |
| 'host')) |
| |
| |
| def tearDown(self): |
| shutil.rmtree(self.tmpdir) |
| |
| |
| if __name__ == '__main__': |
| unittest_setup.setup() |
| unittest.main() |