{"action":"created","comment":{"url":"https://api.github.com/repos/audreyr/cookiecutter/pulls/comments/131527823","pull_request_review_id":54520828,"id":131527823,"diff_hunk":"@@ -115,6 +119,65 @@ def test_oserror_hooks(mocker):\n     assert message in str(excinfo.value)\n \n \n+@pytest.mark.usefixtures('clean_system', 'remove_additional_folders')\n+def test_run_failing_hook_removes_output_directory():\n+    repo_path = os.path.abspath('tests/test-hooks/')\n+    hooks_path = os.path.abspath('tests/test-hooks/hooks')\n+\n+    hook_dir = os.path.join(repo_path, 'hooks')\n+    template = os.path.join(repo_path, 'input{{cookiecutter.hooks}}')\n+    os.mkdir(repo_path)\n+    os.mkdir(hook_dir)\n+    os.mkdir(template)\n+\n+    hook_path = os.path.join(hooks_path, 'pre_gen_project.py')\n+\n+    with open(hook_path, 'w') as f:\n+        f.write(\"#!/usr/bin/env python\\n\")\n+        f.write(\"import sys; sys.exit(1)\\n\")\n+\n+    with pytest.raises(FailedHookException) as excinfo:\n+        generate.generate_files(\n+            context={\n+                'cookiecutter': {'hooks': 'hooks'}\n+            },\n+            repo_dir='tests/test-hooks/',\n+            overwrite_if_exists=True\n+        )\n+        assert 'Hook script failed' in str(excinfo.value)","path":"tests/test_generate_hooks.py","position":52,"original_position":52,"commit_id":"3f8ea30538c66b895653e3cc03383ac530a515a9","original_commit_id":"3f8ea30538c66b895653e3cc03383ac530a515a9","user":{"login":"hackebrot","id":6024445,"avatar_url":"https://avatars1.githubusercontent.com/u/6024445?v=4","gravatar_id":"","url":"https://api.github.com/users/hackebrot","html_url":"https://github.com/hackebrot","followers_url":"https://api.github.com/users/hackebrot/followers","following_url":"https://api.github.com/users/hackebrot/following{/other_user}","gists_url":"https://api.github.com/users/hackebrot/gists{/gist_id}","starred_url":"https://api.github.com/users/hackebrot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hackebrot/subscriptions","organizations_url":"https://api.github.com/users/hackebrot/orgs","repos_url":"https://api.github.com/users/hackebrot/repos","events_url":"https://api.github.com/users/hackebrot/events{/privacy}","received_events_url":"https://api.github.com/users/hackebrot/received_events","type":"User","site_admin":false},"body":"The assertion needs to be outside of the context manager, since the ``FailedHookException`` will cause the block to exit on ``generate_files()``. ","created_at":"2017-08-05T19:09:53Z","updated_at":"2017-08-05T19:27:13Z","html_url":"https://github.com/audreyr/cookiecutter/pull/964#discussion_r131527823","pull_request_url":"https://api.github.com/repos/audreyr/cookiecutter/pulls/964","_links":{"self":{"href":"https://api.github.com/repos/audreyr/cookiecutter/pulls/comments/131527823"},"html":{"href":"https://github.com/audreyr/cookiecutter/pull/964#discussion_r131527823"},"pull_request":{"href":"https://api.github.com/repos/audreyr/cookiecutter/pulls/964"}}},"pull_request":{"url":"https://api.github.com/repos/audreyr/cookiecutter/pulls/964","id":127950164,"html_url":"https://github.com/audreyr/cookiecutter/pull/964","diff_url":"https://github.com/audreyr/cookiecutter/pull/964.diff","patch_url":"https://github.com/audreyr/cookiecutter/pull/964.patch","issue_url":"https://api.github.com/repos/audreyr/cookiecutter/issues/964","number":964,"state":"open","locked":false,"title":"Preserve existing output directory on failure","user":{"login":"michaeljoseph","id":169933,"avatar_url":"https://avatars1.githubusercontent.com/u/169933?v=4","gravatar_id":"","url":"https://api.github.com/users/michaeljoseph","html_url":"https://github.com/michaeljoseph","followers_url":"https://api.github.com/users/michaeljoseph/followers","following_url":"https://api.github.com/users/michaeljoseph/following{/other_user}","gists_url":"https://api.github.com/users/michaeljoseph/gists{/gist_id}","starred_url":"https://api.github.com/users/michaeljoseph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaeljoseph/subscriptions","organizations_url":"https://api.github.com/users/michaeljoseph/orgs","repos_url":"https://api.github.com/users/michaeljoseph/repos","events_url":"https://api.github.com/users/michaeljoseph/events{/privacy}","received_events_url":"https://api.github.com/users/michaeljoseph/received_events","type":"User","site_admin":false},"body":"If a generated output directory already exists, we don't delete it on project generation failure.\r\n\r\nSupersedes #684.\r\nFixes #629. ","created_at":"2017-06-28T15:21:42Z","updated_at":"2017-08-05T19:27:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b186b9c258c5e0960d8972a73f9ceddacbce1006","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/audreyr/cookiecutter/pulls/964/commits","review_comments_url":"https://api.github.com/repos/audreyr/cookiecutter/pulls/964/comments","review_comment_url":"https://api.github.com/repos/audreyr/cookiecutter/pulls/comments{/number}","comments_url":"https://api.github.com/repos/audreyr/cookiecutter/issues/964/comments","statuses_url":"https://api.github.com/repos/audreyr/cookiecutter/statuses/3f8ea30538c66b895653e3cc03383ac530a515a9","head":{"label":"michaeljoseph:629-preserve-existing-directory-on-failure","ref":"629-preserve-existing-directory-on-failure","sha":"3f8ea30538c66b895653e3cc03383ac530a515a9","user":{"login":"michaeljoseph","id":169933,"avatar_url":"https://avatars1.githubusercontent.com/u/169933?v=4","gravatar_id":"","url":"https://api.github.com/users/michaeljoseph","html_url":"https://github.com/michaeljoseph","followers_url":"https://api.github.com/users/michaeljoseph/followers","following_url":"https://api.github.com/users/michaeljoseph/following{/other_user}","gists_url":"https://api.github.com/users/michaeljoseph/gists{/gist_id}","starred_url":"https://api.github.com/users/michaeljoseph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaeljoseph/subscriptions","organizations_url":"https://api.github.com/users/michaeljoseph/orgs","repos_url":"https://api.github.com/users/michaeljoseph/repos","events_url":"https://api.github.com/users/michaeljoseph/events{/privacy}","received_events_url":"https://api.github.com/users/michaeljoseph/received_events","type":"User","site_admin":false},"repo":{"id":13468213,"name":"cookiecutter","full_name":"michaeljoseph/cookiecutter","owner":{"login":"michaeljoseph","id":169933,"avatar_url":"https://avatars1.githubusercontent.com/u/169933?v=4","gravatar_id":"","url":"https://api.github.com/users/michaeljoseph","html_url":"https://github.com/michaeljoseph","followers_url":"https://api.github.com/users/michaeljoseph/followers","following_url":"https://api.github.com/users/michaeljoseph/following{/other_user}","gists_url":"https://api.github.com/users/michaeljoseph/gists{/gist_id}","starred_url":"https://api.github.com/users/michaeljoseph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaeljoseph/subscriptions","organizations_url":"https://api.github.com/users/michaeljoseph/orgs","repos_url":"https://api.github.com/users/michaeljoseph/repos","events_url":"https://api.github.com/users/michaeljoseph/events{/privacy}","received_events_url":"https://api.github.com/users/michaeljoseph/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/michaeljoseph/cookiecutter","description":"A command-line utility that creates projects from cookiecutters (project templates). E.g. Python package projects, jQuery plugin projects.","fork":true,"url":"https://api.github.com/repos/michaeljoseph/cookiecutter","forks_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/forks","keys_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/teams","hooks_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/hooks","issue_events_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/issues/events{/number}","events_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/events","assignees_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/assignees{/user}","branches_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/branches{/branch}","tags_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/tags","blobs_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/git/refs{/sha}","trees_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/statuses/{sha}","languages_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/languages","stargazers_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/stargazers","contributors_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/contributors","subscribers_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/subscribers","subscription_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/subscription","commits_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/commits{/sha}","git_commits_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/git/commits{/sha}","comments_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/comments{/number}","issue_comment_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/issues/comments{/number}","contents_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/contents/{+path}","compare_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/merges","archive_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/downloads","issues_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/issues{/number}","pulls_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/pulls{/number}","milestones_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/milestones{/number}","notifications_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/labels{/name}","releases_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/releases{/id}","deployments_url":"https://api.github.com/repos/michaeljoseph/cookiecutter/deployments","created_at":"2013-10-10T10:17:21Z","updated_at":"2015-04-09T17:45:12Z","pushed_at":"2017-07-18T07:43:10Z","git_url":"git://github.com/michaeljoseph/cookiecutter.git","ssh_url":"git@github.com:michaeljoseph/cookiecutter.git","clone_url":"https://github.com/michaeljoseph/cookiecutter.git","svn_url":"https://github.com/michaeljoseph/cookiecutter","homepage":"","size":2038,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"audreyr:master","ref":"master","sha":"ba5ba8c78e97f5dc7fb4e16c588d7be037e6e5e7","user":{"login":"audreyr","id":74739,"avatar_url":"https://avatars0.githubusercontent.com/u/74739?v=4","gravatar_id":"","url":"https://api.github.com/users/audreyr","html_url":"https://github.com/audreyr","followers_url":"https://api.github.com/users/audreyr/followers","following_url":"https://api.github.com/users/audreyr/following{/other_user}","gists_url":"https://api.github.com/users/audreyr/gists{/gist_id}","starred_url":"https://api.github.com/users/audreyr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/audreyr/subscriptions","organizations_url":"https://api.github.com/users/audreyr/orgs","repos_url":"https://api.github.com/users/audreyr/repos","events_url":"https://api.github.com/users/audreyr/events{/privacy}","received_events_url":"https://api.github.com/users/audreyr/received_events","type":"User","site_admin":false},"repo":{"id":11407242,"name":"cookiecutter","full_name":"audreyr/cookiecutter","owner":{"login":"audreyr","id":74739,"avatar_url":"https://avatars0.githubusercontent.com/u/74739?v=4","gravatar_id":"","url":"https://api.github.com/users/audreyr","html_url":"https://github.com/audreyr","followers_url":"https://api.github.com/users/audreyr/followers","following_url":"https://api.github.com/users/audreyr/following{/other_user}","gists_url":"https://api.github.com/users/audreyr/gists{/gist_id}","starred_url":"https://api.github.com/users/audreyr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/audreyr/subscriptions","organizations_url":"https://api.github.com/users/audreyr/orgs","repos_url":"https://api.github.com/users/audreyr/repos","events_url":"https://api.github.com/users/audreyr/events{/privacy}","received_events_url":"https://api.github.com/users/audreyr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/audreyr/cookiecutter","description":"A command-line utility that creates projects from cookiecutters (project templates). E.g. Python package projects, jQuery plugin projects.","fork":false,"url":"https://api.github.com/repos/audreyr/cookiecutter","forks_url":"https://api.github.com/repos/audreyr/cookiecutter/forks","keys_url":"https://api.github.com/repos/audreyr/cookiecutter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/audreyr/cookiecutter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/audreyr/cookiecutter/teams","hooks_url":"https://api.github.com/repos/audreyr/cookiecutter/hooks","issue_events_url":"https://api.github.com/repos/audreyr/cookiecutter/issues/events{/number}","events_url":"https://api.github.com/repos/audreyr/cookiecutter/events","assignees_url":"https://api.github.com/repos/audreyr/cookiecutter/assignees{/user}","branches_url":"https://api.github.com/repos/audreyr/cookiecutter/branches{/branch}","tags_url":"https://api.github.com/repos/audreyr/cookiecutter/tags","blobs_url":"https://api.github.com/repos/audreyr/cookiecutter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/audreyr/cookiecutter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/audreyr/cookiecutter/git/refs{/sha}","trees_url":"https://api.github.com/repos/audreyr/cookiecutter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/audreyr/cookiecutter/statuses/{sha}","languages_url":"https://api.github.com/repos/audreyr/cookiecutter/languages","stargazers_url":"https://api.github.com/repos/audreyr/cookiecutter/stargazers","contributors_url":"https://api.github.com/repos/audreyr/cookiecutter/contributors","subscribers_url":"https://api.github.com/repos/audreyr/cookiecutter/subscribers","subscription_url":"https://api.github.com/repos/audreyr/cookiecutter/subscription","commits_url":"https://api.github.com/repos/audreyr/cookiecutter/commits{/sha}","git_commits_url":"https://api.github.com/repos/audreyr/cookiecutter/git/commits{/sha}","comments_url":"https://api.github.com/repos/audreyr/cookiecutter/comments{/number}","issue_comment_url":"https://api.github.com/repos/audreyr/cookiecutter/issues/comments{/number}","contents_url":"https://api.github.com/repos/audreyr/cookiecutter/contents/{+path}","compare_url":"https://api.github.com/repos/audreyr/cookiecutter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/audreyr/cookiecutter/merges","archive_url":"https://api.github.com/repos/audreyr/cookiecutter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/audreyr/cookiecutter/downloads","issues_url":"https://api.github.com/repos/audreyr/cookiecutter/issues{/number}","pulls_url":"https://api.github.com/repos/audreyr/cookiecutter/pulls{/number}","milestones_url":"https://api.github.com/repos/audreyr/cookiecutter/milestones{/number}","notifications_url":"https://api.github.com/repos/audreyr/cookiecutter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/audreyr/cookiecutter/labels{/name}","releases_url":"https://api.github.com/repos/audreyr/cookiecutter/releases{/id}","deployments_url":"https://api.github.com/repos/audreyr/cookiecutter/deployments","created_at":"2013-07-14T18:31:22Z","updated_at":"2017-08-05T17:36:50Z","pushed_at":"2017-08-03T21:49:26Z","git_url":"git://github.com/audreyr/cookiecutter.git","ssh_url":"git@github.com:audreyr/cookiecutter.git","clone_url":"https://github.com/audreyr/cookiecutter.git","svn_url":"https://github.com/audreyr/cookiecutter","homepage":"","size":2078,"stargazers_count":5501,"watchers_count":5501,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":620,"mirror_url":null,"open_issues_count":117,"forks":620,"open_issues":117,"watchers":5501,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/audreyr/cookiecutter/pulls/964"},"html":{"href":"https://github.com/audreyr/cookiecutter/pull/964"},"issue":{"href":"https://api.github.com/repos/audreyr/cookiecutter/issues/964"},"comments":{"href":"https://api.github.com/repos/audreyr/cookiecutter/issues/964/comments"},"review_comments":{"href":"https://api.github.com/repos/audreyr/cookiecutter/pulls/964/comments"},"review_comment":{"href":"https://api.github.com/repos/audreyr/cookiecutter/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/audreyr/cookiecutter/pulls/964/commits"},"statuses":{"href":"https://api.github.com/repos/audreyr/cookiecutter/statuses/3f8ea30538c66b895653e3cc03383ac530a515a9"}}}}
{"actor":{"display_login":"hackebrot"}}