def test_pyc_invalidation_mode(self):
    script_helper.make_script(self.pkgdir, 'f1', '')
    pyc = importlib.util.cache_from_source(os.path.join(self.pkgdir, 'f1.py'))
    self.assertRunOK('--invalidation-mode=checked-hash', self.pkgdir)
    with open(pyc, 'rb') as fp:
        data = fp.read()
    self.assertEqual(int.from_bytes(data[4:8], 'little'), 3)
    self.assertRunOK('--invalidation-mode=unchecked-hash', self.pkgdir)
    with open(pyc, 'rb') as fp:
        data = fp.read()
    self.assertEqual(int.from_bytes(data[4:8], 'little'), 1)
def test_pyc_invalidation_mode(self):
    script_helper.make_script(self.pkgdir, 'f1', )
    pyc = importlib.util.cache_from_source(os.path.join(self.pkgdir, 'f1.py'))
    self.assertRunOK('--invalidation-mode=checked-hash', self.pkgdir)
    with open(pyc, 'rb') as fp:
        data = fp.read()
    self.assertEqual(int.from_bytes(data[4:8], 'little'), 3)
    self.assertRunOK('--invalidation-mode=unchecked-hash', self.pkgdir)
    with open(pyc, 'rb') as fp:
        data = fp.read()
    self.assertEqual(int.from_bytes(data[4:8], 'little'), 1)