hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#
# SPDX-License-Identifier: MIT
#
 
import glob
import os
import shutil
from oeqa.utils.commands import bitbake, get_test_layer
from oeqa.selftest.case import OESelftestTestCase
 
class Pseudo(OESelftestTestCase):
 
    def test_pseudo_pyc_creation(self):
        self.write_config("")
 
        metaselftestpath = get_test_layer()
        pycache_path = os.path.join(metaselftestpath, 'lib/__pycache__')
        if os.path.exists(pycache_path):
            shutil.rmtree(pycache_path)
 
        bitbake('pseudo-pyc-test -c install')
 
        test1_pyc_present = len(glob.glob(os.path.join(pycache_path, 'pseudo_pyc_test1.*.pyc')))
        self.assertTrue(test1_pyc_present, 'test1 pyc file missing, should be created outside of pseudo context.')
 
        test2_pyc_present = len(glob.glob(os.path.join(pycache_path, 'pseudo_pyc_test2.*.pyc')))
        self.assertFalse(test2_pyc_present, 'test2 pyc file present, should not be created in pseudo context.')