'When a file containing an error is imported in a function wrapped by
check_errors(), gen_filenames(only_new=True) returns it.'

def test_check_errors_only_new(self):

    dirname = tempfile.mkdtemp()
    filename = os.path.join(dirname, 'test_syntax_error.py')
    self.addCleanup(shutil.rmtree, dirname)
    with open(filename, 'w') as f:
        f.write("Ceci    n'est    pas    du    Python.")
    with extend_sys_path(dirname):
        with self.assertRaises(SyntaxError):
            autoreload.check_errors(import_module)('test_syntax_error')
    self.assertFileFoundOnlyNew(filename)
