diff options
Diffstat (limited to 'bitbake/lib/layerindexlib/tests/common.py')
-rw-r--r-- | bitbake/lib/layerindexlib/tests/common.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/bitbake/lib/layerindexlib/tests/common.py b/bitbake/lib/layerindexlib/tests/common.py new file mode 100644 index 0000000000..22a54585c8 --- /dev/null +++ b/bitbake/lib/layerindexlib/tests/common.py | |||
@@ -0,0 +1,43 @@ | |||
1 | # Copyright (C) 2017-2018 Wind River Systems, Inc. | ||
2 | # | ||
3 | # This program is free software; you can redistribute it and/or modify | ||
4 | # it under the terms of the GNU General Public License version 2 as | ||
5 | # published by the Free Software Foundation. | ||
6 | # | ||
7 | # This program is distributed in the hope that it will be useful, | ||
8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
10 | # See the GNU General Public License for more details. | ||
11 | # | ||
12 | # You should have received a copy of the GNU General Public License | ||
13 | # along with this program; if not, write to the Free Software | ||
14 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
15 | |||
16 | import unittest | ||
17 | import tempfile | ||
18 | import os | ||
19 | import bb | ||
20 | |||
21 | import logging | ||
22 | |||
23 | class LayersTest(unittest.TestCase): | ||
24 | |||
25 | def setUp(self): | ||
26 | self.origdir = os.getcwd() | ||
27 | self.d = bb.data.init() | ||
28 | # At least one variable needs to be set | ||
29 | self.d.setVar('DL_DIR', os.getcwd()) | ||
30 | |||
31 | if os.environ.get("BB_SKIP_NETTESTS") == "yes": | ||
32 | self.d.setVar('BB_NO_NETWORK', '1') | ||
33 | |||
34 | self.tempdir = tempfile.mkdtemp() | ||
35 | self.logger = logging.getLogger("BitBake") | ||
36 | |||
37 | def tearDown(self): | ||
38 | os.chdir(self.origdir) | ||
39 | if os.environ.get("BB_TMPDIR_NOCLEAN") == "yes": | ||
40 | print("Not cleaning up %s. Please remove manually." % self.tempdir) | ||
41 | else: | ||
42 | bb.utils.prunedir(self.tempdir) | ||
43 | |||