11a4b7ee2SBrad Bishop# Copyright (C) 2017-2018 Wind River Systems, Inc. 21a4b7ee2SBrad Bishop# 3*c342db35SBrad Bishop# SPDX-License-Identifier: GPL-2.0-only 41a4b7ee2SBrad Bishop# 51a4b7ee2SBrad Bishop 61a4b7ee2SBrad Bishopimport unittest 71a4b7ee2SBrad Bishopimport tempfile 81a4b7ee2SBrad Bishopimport os 91a4b7ee2SBrad Bishopimport bb 101a4b7ee2SBrad Bishop 111a4b7ee2SBrad Bishopimport logging 121a4b7ee2SBrad Bishop 131a4b7ee2SBrad Bishopclass LayersTest(unittest.TestCase): 141a4b7ee2SBrad Bishop 151a4b7ee2SBrad Bishop def setUp(self): 161a4b7ee2SBrad Bishop self.origdir = os.getcwd() 171a4b7ee2SBrad Bishop self.d = bb.data.init() 181a4b7ee2SBrad Bishop # At least one variable needs to be set 191a4b7ee2SBrad Bishop self.d.setVar('DL_DIR', os.getcwd()) 201a4b7ee2SBrad Bishop 211a4b7ee2SBrad Bishop if os.environ.get("BB_SKIP_NETTESTS") == "yes": 221a4b7ee2SBrad Bishop self.d.setVar('BB_NO_NETWORK', '1') 231a4b7ee2SBrad Bishop 241a4b7ee2SBrad Bishop self.tempdir = tempfile.mkdtemp() 251a4b7ee2SBrad Bishop self.logger = logging.getLogger("BitBake") 261a4b7ee2SBrad Bishop 271a4b7ee2SBrad Bishop def tearDown(self): 281a4b7ee2SBrad Bishop os.chdir(self.origdir) 291a4b7ee2SBrad Bishop if os.environ.get("BB_TMPDIR_NOCLEAN") == "yes": 301a4b7ee2SBrad Bishop print("Not cleaning up %s. Please remove manually." % self.tempdir) 311a4b7ee2SBrad Bishop else: 321a4b7ee2SBrad Bishop bb.utils.prunedir(self.tempdir) 331a4b7ee2SBrad Bishop 34