def recreation_check(self, metadata):
    'Check that compileall recreates bytecode when the new metadata is\n        used.'
    if os.environ.get('SOURCE_DATE_EPOCH'):
        raise unittest.SkipTest('SOURCE_DATE_EPOCH is set')
    py_compile.compile(self.source_path)
    self.assertEqual(*self.timestamp_metadata())
    with open(self.bc_path, 'rb') as file:
        bc = file.read()[len(metadata):]
    with open(self.bc_path, 'wb') as file:
        file.write(metadata)
        file.write(bc)
    self.assertNotEqual(*self.timestamp_metadata())
    compileall.compile_dir(self.directory, force=False, quiet=True)
    self.assertTrue(*self.timestamp_metadata())
Check that compileall recreates bytecode when the new metadata is
used.
def recreation_check(self, metadata):
    'Check that compileall recreates bytecode when the new metadata is\n        used.'
    if os.environ.get('SOURCE_DATE_EPOCH'):
        raise unittest.SkipTest('SOURCE_DATE_EPOCH is set')
    py_compile.compile(self.source_path)
    self.assertEqual(*self.timestamp_metadata())
    with open(self.bc_path, 'rb') as file:
        bc = file.read()[len(metadata):]
    with open(self.bc_path, 'wb') as file:
        file.write(metadata)
        file.write(bc)
    self.assertNotEqual(*self.timestamp_metadata())
    compileall.compile_dir(self.directory, force=False, quiet=True)
    self.assertTrue(*self.timestamp_metadata())