summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/layerindexlib/tests/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/layerindexlib/tests/common.py')
-rw-r--r--bitbake/lib/layerindexlib/tests/common.py43
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
16import unittest
17import tempfile
18import os
19import bb
20
21import logging
22
23class 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