pseudo.py 953 B

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