@@ -481,7 +481,6 @@ def test_commit_hooks_respected(tmp_path_factory: pytest.TempPathFactory) -> Non
481481 assert Path (f"{ life } .rej" ).is_file ()
482482
483483
484- @pytest .mark .impure
485484def test_post_checkout_hook_ignored (tmp_path_factory : pytest .TempPathFactory ) -> None :
486485 """Ignore post-checkout hook when conflicts are encountered."""
487486 # Prepare source template v1
@@ -493,8 +492,6 @@ def test_post_checkout_hook_ignored(tmp_path_factory: pytest.TempPathFactory) ->
493492 f"""
494493 _envops: { BRACKET_ENVOPS_JSON }
495494 _templates_suffix: { SUFFIX_TMPL }
496- _tasks:
497- - git init
498495 """
499496 ),
500497 "[[ _copier_conf.answers_file ]].tmpl" : (
@@ -513,20 +510,18 @@ def test_post_checkout_hook_ignored(tmp_path_factory: pytest.TempPathFactory) ->
513510 run_copy (
514511 src_path = str (src ),
515512 dst_path = dst ,
516- defaults = True ,
517- overwrite = False ,
518- unsafe = True ,
519513 )
520514 with local .cwd (dst ):
515+ git ("init" )
521516 git ("add" , "." )
522517 # Commit initial copy
523518 git ("commit" , "-am" , "feat: copied v1" )
524519 # Introduce conflict
525- Path (dst / "test.txt" ).open ( mode = "w" ). write ("This is a conflicting change" )
520+ Path ("test.txt" ).write_text ("This is a conflicting change" )
526521 git ("add" , "." )
527522 git ("commit" , "-am" , "feat: edit test.txt" )
528523 # Add post-checkout hook that fails
529- hook_file = dst / ".git" / "hooks" / "post-checkout"
524+ hook_file = Path ( ".git" ) / "hooks" / "post-checkout"
530525 hook_file .write_text ("exit 1" )
531526 hook_file .chmod (hook_file .stat ().st_mode | stat .S_IXUSR )
532527 # Evolve source template to v2
@@ -536,19 +531,14 @@ def test_post_checkout_hook_ignored(tmp_path_factory: pytest.TempPathFactory) ->
536531 "test.txt" : "This is an edited file in v2" ,
537532 }
538533 )
539- git ("init" )
540534 git ("add" , "." )
541535 git ("commit" , "-m" , "feat: Update post-checkout" )
542536 git ("tag" , "v2" )
543537 # Update subproject to v2
544538 # No errors should be raised due to post-checkout hook
545539 run_update (
546540 dst_path = dst ,
547- defaults = True ,
548541 overwrite = True ,
549- unsafe = True ,
550- skip_tasks = True ,
551- conflict = "inline" ,
552542 )
553543
554544
0 commit comments