@@ -235,6 +235,66 @@ def test_autoupdate_only_one_to_update(up_to_date, out_of_date, tmpdir):
235235 )
236236
237237
238+ def test_autoupdate_skips_skip_autoupdate_repo (out_of_date , tmpdir ):
239+ before = (
240+ f'repos:\n '
241+ f'- repo: { out_of_date .path } \n '
242+ f' rev: { out_of_date .original_rev } \n '
243+ f' skip_autoupdate: true\n '
244+ f' hooks:\n '
245+ f' - id: foo\n '
246+ f'- repo: { out_of_date .path } \n '
247+ f' rev: { out_of_date .original_rev } \n '
248+ f' hooks:\n '
249+ f' - id: foo\n '
250+ )
251+ expected = (
252+ f'repos:\n '
253+ f'- repo: { out_of_date .path } \n '
254+ f' rev: { out_of_date .original_rev } \n '
255+ f' skip_autoupdate: true\n '
256+ f' hooks:\n '
257+ f' - id: foo\n '
258+ f'- repo: { out_of_date .path } \n '
259+ f' rev: { out_of_date .head_rev } \n '
260+ f' hooks:\n '
261+ f' - id: foo\n '
262+ )
263+ cfg = tmpdir .join (C .CONFIG_FILE )
264+ cfg .write (before )
265+
266+ assert autoupdate (str (cfg ), freeze = False , tags_only = False ) == 0
267+ assert cfg .read () == expected
268+
269+
270+ def test_autoupdate_repo_overrides_skip_autoupdate (out_of_date , tmpdir ):
271+ before = (
272+ f'repos:\n '
273+ f'- repo: { out_of_date .path } \n '
274+ f' rev: { out_of_date .original_rev } \n '
275+ f' skip_autoupdate: true\n '
276+ f' hooks:\n '
277+ f' - id: foo\n '
278+ )
279+ expected = (
280+ f'repos:\n '
281+ f'- repo: { out_of_date .path } \n '
282+ f' rev: { out_of_date .head_rev } \n '
283+ f' skip_autoupdate: true\n '
284+ f' hooks:\n '
285+ f' - id: foo\n '
286+ )
287+ cfg = tmpdir .join (C .CONFIG_FILE )
288+ cfg .write (before )
289+
290+ ret = autoupdate (
291+ str (cfg ), freeze = False , tags_only = False ,
292+ repos = (out_of_date .path ,),
293+ )
294+ assert ret == 0
295+ assert cfg .read () == expected
296+
297+
238298def test_autoupdate_out_of_date_repo_with_correct_repo_name (
239299 out_of_date , in_tmpdir ,
240300):
0 commit comments