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