blob: 3ef878602266d4c2d37fe46d4222237312dc1f6a [file] [log] [blame]
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001#
Patrick Williams92b42cb2022-09-03 06:53:57 -05002# Copyright OpenEmbedded Contributors
3#
Andrew Geisslerd1e89492021-02-12 15:35:20 -06004# SPDX-License-Identifier: MIT
5#
6
7import glob
8import os
9import shutil
10from oeqa.utils.commands import bitbake, get_test_layer
11from oeqa.selftest.case import OESelftestTestCase
12
13class Pseudo(OESelftestTestCase):
14
15 def test_pseudo_pyc_creation(self):
16 self.write_config("")
17
18 metaselftestpath = get_test_layer()
19 pycache_path = os.path.join(metaselftestpath, 'lib/__pycache__')
20 if os.path.exists(pycache_path):
21 shutil.rmtree(pycache_path)
22
23 bitbake('pseudo-pyc-test -c install')
24
25 test1_pyc_present = len(glob.glob(os.path.join(pycache_path, 'pseudo_pyc_test1.*.pyc')))
26 self.assertTrue(test1_pyc_present, 'test1 pyc file missing, should be created outside of pseudo context.')
27
28 test2_pyc_present = len(glob.glob(os.path.join(pycache_path, 'pseudo_pyc_test2.*.pyc')))
29 self.assertFalse(test2_pyc_present, 'test2 pyc file present, should not be created in pseudo context.')