def write_file(name, string):
    test_file = os.path.join(TEST_DIR, ('derives-span-%s.rs' % name))
    if os.path.exists(test_file):
        os.chmod(test_file, stat.S_IWUSR)
    with open(test_file, 'wt') as f:
        f.write(string)
    os.chmod(test_file, ((stat.S_IRUSR | stat.S_IRGRP) | stat.S_IROTH))
def write_file(name, string):
    test_file = os.path.join(TEST_DIR, ('derives-span-%s.rs' % name))
    if os.path.exists(test_file):
        os.chmod(test_file, stat.S_IWUSR)
    with open(test_file, 'wt') as f:
        f.write(string)
    os.chmod(test_file, ((stat.S_IRUSR | stat.S_IRGRP) | stat.S_IROTH))