Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 1 | # Copyright (C) 2017-2018 Wind River Systems, Inc. |
| 2 | # |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 3 | # SPDX-License-Identifier: GPL-2.0-only |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 4 | # |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 5 | |
| 6 | import unittest |
| 7 | import tempfile |
| 8 | import os |
| 9 | import bb |
| 10 | |
| 11 | import logging |
| 12 | |
| 13 | class LayersTest(unittest.TestCase): |
| 14 | |
| 15 | def setUp(self): |
| 16 | self.origdir = os.getcwd() |
| 17 | self.d = bb.data.init() |
| 18 | # At least one variable needs to be set |
| 19 | self.d.setVar('DL_DIR', os.getcwd()) |
| 20 | |
| 21 | if os.environ.get("BB_SKIP_NETTESTS") == "yes": |
| 22 | self.d.setVar('BB_NO_NETWORK', '1') |
| 23 | |
| 24 | self.tempdir = tempfile.mkdtemp() |
| 25 | self.logger = logging.getLogger("BitBake") |
| 26 | |
| 27 | def tearDown(self): |
| 28 | os.chdir(self.origdir) |
| 29 | if os.environ.get("BB_TMPDIR_NOCLEAN") == "yes": |
| 30 | print("Not cleaning up %s. Please remove manually." % self.tempdir) |
| 31 | else: |
| 32 | bb.utils.prunedir(self.tempdir) |
| 33 | |