{"action":"created","comment":{"url":"https://api.github.com/repos/mixxorz/behave-django/pulls/comments/32966203","id":32966203,"diff_hunk":"@@ -0,0 +1,62 @@\n+try:\n+    from django.test.runner import DiscoverRunner\n+except ImportError:\n+    from django.test.simple import DjangoTestSuiteRunner as DiscoverRunner\n+\n+from django.core.management import call_command\n+\n+try:\n+    from django.shortcuts import resolve_url\n+except ImportError:\n+    # support Django 1.4, which has no resolve_url() yet\n+    from django.shortcuts import redirect\n+\n+    resolve_url = lambda to, *args, **kwargs: \\\n+        redirect(to, *args, **kwargs)['Location']\n+\n+from behave_django.testcase import (BehaviorDrivenTestCase,\n+                                    ExistingDatabaseTestCase)\n+\n+\n+class BehaviorDrivenTestRunner(DiscoverRunner):\n+    testcase_class = BehaviorDrivenTestCase\n+\n+    def before_scenario(self, context):\n+        context.test = self.testcase_class()\n+        context.test.setUpClass()\n+        context.test()\n+\n+        context.base_url = context.test.live_server_url\n+\n+        def get_url(to=None, *args, **kwargs):\n+            return context.base_url + (\n+                resolve_url(to, *args, **kwargs) if to else '')\n+\n+        context.get_url = get_url\n+\n+    def load_fixtures(self, context):","path":"behave_django/runner.py","position":37,"original_position":37,"commit_id":"fd82dd67d287af13c2ecf996d4b32e95667a9dc8","original_commit_id":"fd82dd67d287af13c2ecf996d4b32e95667a9dc8","user":{"login":"bittner","id":665072,"avatar_url":"https://avatars.githubusercontent.com/u/665072?v=3","gravatar_id":"","url":"https://api.github.com/users/bittner","html_url":"https://github.com/bittner","followers_url":"https://api.github.com/users/bittner/followers","following_url":"https://api.github.com/users/bittner/following{/other_user}","gists_url":"https://api.github.com/users/bittner/gists{/gist_id}","starred_url":"https://api.github.com/users/bittner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bittner/subscriptions","organizations_url":"https://api.github.com/users/bittner/orgs","repos_url":"https://api.github.com/users/bittner/repos","events_url":"https://api.github.com/users/bittner/events{/privacy}","received_events_url":"https://api.github.com/users/bittner/received_events","type":"User","site_admin":false},"body":"This was necessary to allow fixtures be defined in `environment.before_scenario()` and loaded *after* `before_scenario()` was completed. Also, because the integration of django into behave needs to run *before* `environment.before_scenario()` is reached. The documentation on factories supported that point too.","created_at":"2015-06-22T18:22:29Z","updated_at":"2015-06-22T18:22:29Z","html_url":"https://github.com/mixxorz/behave-django/pull/28#discussion_r32966203","pull_request_url":"https://api.github.com/repos/mixxorz/behave-django/pulls/28","_links":{"self":{"href":"https://api.github.com/repos/mixxorz/behave-django/pulls/comments/32966203"},"html":{"href":"https://github.com/mixxorz/behave-django/pull/28#discussion_r32966203"},"pull_request":{"href":"https://api.github.com/repos/mixxorz/behave-django/pulls/28"}}},"pull_request":{"url":"https://api.github.com/repos/mixxorz/behave-django/pulls/28","id":38229288,"html_url":"https://github.com/mixxorz/behave-django/pull/28","diff_url":"https://github.com/mixxorz/behave-django/pull/28.diff","patch_url":"https://github.com/mixxorz/behave-django/pull/28.patch","issue_url":"https://api.github.com/repos/mixxorz/behave-django/issues/28","number":28,"state":"open","locked":false,"title":"Don't create test DB with options --use-existing-database and --dry-run","user":{"login":"bittner","id":665072,"avatar_url":"https://avatars.githubusercontent.com/u/665072?v=3","gravatar_id":"","url":"https://api.github.com/users/bittner","html_url":"https://github.com/bittner","followers_url":"https://api.github.com/users/bittner/followers","following_url":"https://api.github.com/users/bittner/following{/other_user}","gists_url":"https://api.github.com/users/bittner/gists{/gist_id}","starred_url":"https://api.github.com/users/bittner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bittner/subscriptions","organizations_url":"https://api.github.com/users/bittner/orgs","repos_url":"https://api.github.com/users/bittner/repos","events_url":"https://api.github.com/users/bittner/events{/privacy}","received_events_url":"https://api.github.com/users/bittner/received_events","type":"User","site_admin":false},"body":"This commit is crazy: Apart from adding features it changes the API of behave-django.\r\n\r\n* No integration code in your BDD test suite's `environment.py` is needed anymore. behave-django integrates itself into behave by help of a monkey patch.\r\n* Integration code has moved from `environment.py` to `runner.py`, which provides two runners, a regular one and one that does not create a test database.\r\n* The testcase module now provides a test case for dry-run and use-existing-database. This is needed in addition to the additional test runner.\r\n\r\nI still need to provide tests: (let's call it \"code review\" as long as they're not provided)\r\n\r\n* test_dont_create_db_with_option_dryrun\r\n* test_dont_create_db_with_option_useexistingdb\r\n\r\nFixes #11.\r\nFixes #27.","created_at":"2015-06-22T13:05:20Z","updated_at":"2015-06-22T18:22:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d82e2f8621ef2e4308e39f886b39a54151cf9827","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mixxorz/behave-django/pulls/28/commits","review_comments_url":"https://api.github.com/repos/mixxorz/behave-django/pulls/28/comments","review_comment_url":"https://api.github.com/repos/mixxorz/behave-django/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mixxorz/behave-django/issues/28/comments","statuses_url":"https://api.github.com/repos/mixxorz/behave-django/statuses/fd82dd67d287af13c2ecf996d4b32e95667a9dc8","head":{"label":"bittner:feature/use-existing-database","ref":"feature/use-existing-database","sha":"fd82dd67d287af13c2ecf996d4b32e95667a9dc8","user":{"login":"bittner","id":665072,"avatar_url":"https://avatars.githubusercontent.com/u/665072?v=3","gravatar_id":"","url":"https://api.github.com/users/bittner","html_url":"https://github.com/bittner","followers_url":"https://api.github.com/users/bittner/followers","following_url":"https://api.github.com/users/bittner/following{/other_user}","gists_url":"https://api.github.com/users/bittner/gists{/gist_id}","starred_url":"https://api.github.com/users/bittner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bittner/subscriptions","organizations_url":"https://api.github.com/users/bittner/orgs","repos_url":"https://api.github.com/users/bittner/repos","events_url":"https://api.github.com/users/bittner/events{/privacy}","received_events_url":"https://api.github.com/users/bittner/received_events","type":"User","site_admin":false},"repo":{"id":36365025,"name":"behave-django","full_name":"bittner/behave-django","owner":{"login":"bittner","id":665072,"avatar_url":"https://avatars.githubusercontent.com/u/665072?v=3","gravatar_id":"","url":"https://api.github.com/users/bittner","html_url":"https://github.com/bittner","followers_url":"https://api.github.com/users/bittner/followers","following_url":"https://api.github.com/users/bittner/following{/other_user}","gists_url":"https://api.github.com/users/bittner/gists{/gist_id}","starred_url":"https://api.github.com/users/bittner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bittner/subscriptions","organizations_url":"https://api.github.com/users/bittner/orgs","repos_url":"https://api.github.com/users/bittner/repos","events_url":"https://api.github.com/users/bittner/events{/privacy}","received_events_url":"https://api.github.com/users/bittner/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bittner/behave-django","description":"Behave BDD integration for Django","fork":true,"url":"https://api.github.com/repos/bittner/behave-django","forks_url":"https://api.github.com/repos/bittner/behave-django/forks","keys_url":"https://api.github.com/repos/bittner/behave-django/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bittner/behave-django/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bittner/behave-django/teams","hooks_url":"https://api.github.com/repos/bittner/behave-django/hooks","issue_events_url":"https://api.github.com/repos/bittner/behave-django/issues/events{/number}","events_url":"https://api.github.com/repos/bittner/behave-django/events","assignees_url":"https://api.github.com/repos/bittner/behave-django/assignees{/user}","branches_url":"https://api.github.com/repos/bittner/behave-django/branches{/branch}","tags_url":"https://api.github.com/repos/bittner/behave-django/tags","blobs_url":"https://api.github.com/repos/bittner/behave-django/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bittner/behave-django/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bittner/behave-django/git/refs{/sha}","trees_url":"https://api.github.com/repos/bittner/behave-django/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bittner/behave-django/statuses/{sha}","languages_url":"https://api.github.com/repos/bittner/behave-django/languages","stargazers_url":"https://api.github.com/repos/bittner/behave-django/stargazers","contributors_url":"https://api.github.com/repos/bittner/behave-django/contributors","subscribers_url":"https://api.github.com/repos/bittner/behave-django/subscribers","subscription_url":"https://api.github.com/repos/bittner/behave-django/subscription","commits_url":"https://api.github.com/repos/bittner/behave-django/commits{/sha}","git_commits_url":"https://api.github.com/repos/bittner/behave-django/git/commits{/sha}","comments_url":"https://api.github.com/repos/bittner/behave-django/comments{/number}","issue_comment_url":"https://api.github.com/repos/bittner/behave-django/issues/comments{/number}","contents_url":"https://api.github.com/repos/bittner/behave-django/contents/{+path}","compare_url":"https://api.github.com/repos/bittner/behave-django/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bittner/behave-django/merges","archive_url":"https://api.github.com/repos/bittner/behave-django/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bittner/behave-django/downloads","issues_url":"https://api.github.com/repos/bittner/behave-django/issues{/number}","pulls_url":"https://api.github.com/repos/bittner/behave-django/pulls{/number}","milestones_url":"https://api.github.com/repos/bittner/behave-django/milestones{/number}","notifications_url":"https://api.github.com/repos/bittner/behave-django/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bittner/behave-django/labels{/name}","releases_url":"https://api.github.com/repos/bittner/behave-django/releases{/id}","created_at":"2015-05-27T12:21:48Z","updated_at":"2015-05-27T12:21:48Z","pushed_at":"2015-06-22T12:47:28Z","git_url":"git://github.com/bittner/behave-django.git","ssh_url":"git@github.com:bittner/behave-django.git","clone_url":"https://github.com/bittner/behave-django.git","svn_url":"https://github.com/bittner/behave-django","homepage":"","size":410,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"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":"mixxorz:master","ref":"master","sha":"e363ed010ffacf71543ae9d58bfa16639e96ac4c","user":{"login":"mixxorz","id":3102758,"avatar_url":"https://avatars.githubusercontent.com/u/3102758?v=3","gravatar_id":"","url":"https://api.github.com/users/mixxorz","html_url":"https://github.com/mixxorz","followers_url":"https://api.github.com/users/mixxorz/followers","following_url":"https://api.github.com/users/mixxorz/following{/other_user}","gists_url":"https://api.github.com/users/mixxorz/gists{/gist_id}","starred_url":"https://api.github.com/users/mixxorz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mixxorz/subscriptions","organizations_url":"https://api.github.com/users/mixxorz/orgs","repos_url":"https://api.github.com/users/mixxorz/repos","events_url":"https://api.github.com/users/mixxorz/events{/privacy}","received_events_url":"https://api.github.com/users/mixxorz/received_events","type":"User","site_admin":false},"repo":{"id":33249544,"name":"behave-django","full_name":"mixxorz/behave-django","owner":{"login":"mixxorz","id":3102758,"avatar_url":"https://avatars.githubusercontent.com/u/3102758?v=3","gravatar_id":"","url":"https://api.github.com/users/mixxorz","html_url":"https://github.com/mixxorz","followers_url":"https://api.github.com/users/mixxorz/followers","following_url":"https://api.github.com/users/mixxorz/following{/other_user}","gists_url":"https://api.github.com/users/mixxorz/gists{/gist_id}","starred_url":"https://api.github.com/users/mixxorz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mixxorz/subscriptions","organizations_url":"https://api.github.com/users/mixxorz/orgs","repos_url":"https://api.github.com/users/mixxorz/repos","events_url":"https://api.github.com/users/mixxorz/events{/privacy}","received_events_url":"https://api.github.com/users/mixxorz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mixxorz/behave-django","description":"Behave BDD integration for Django","fork":false,"url":"https://api.github.com/repos/mixxorz/behave-django","forks_url":"https://api.github.com/repos/mixxorz/behave-django/forks","keys_url":"https://api.github.com/repos/mixxorz/behave-django/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mixxorz/behave-django/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mixxorz/behave-django/teams","hooks_url":"https://api.github.com/repos/mixxorz/behave-django/hooks","issue_events_url":"https://api.github.com/repos/mixxorz/behave-django/issues/events{/number}","events_url":"https://api.github.com/repos/mixxorz/behave-django/events","assignees_url":"https://api.github.com/repos/mixxorz/behave-django/assignees{/user}","branches_url":"https://api.github.com/repos/mixxorz/behave-django/branches{/branch}","tags_url":"https://api.github.com/repos/mixxorz/behave-django/tags","blobs_url":"https://api.github.com/repos/mixxorz/behave-django/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mixxorz/behave-django/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mixxorz/behave-django/git/refs{/sha}","trees_url":"https://api.github.com/repos/mixxorz/behave-django/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mixxorz/behave-django/statuses/{sha}","languages_url":"https://api.github.com/repos/mixxorz/behave-django/languages","stargazers_url":"https://api.github.com/repos/mixxorz/behave-django/stargazers","contributors_url":"https://api.github.com/repos/mixxorz/behave-django/contributors","subscribers_url":"https://api.github.com/repos/mixxorz/behave-django/subscribers","subscription_url":"https://api.github.com/repos/mixxorz/behave-django/subscription","commits_url":"https://api.github.com/repos/mixxorz/behave-django/commits{/sha}","git_commits_url":"https://api.github.com/repos/mixxorz/behave-django/git/commits{/sha}","comments_url":"https://api.github.com/repos/mixxorz/behave-django/comments{/number}","issue_comment_url":"https://api.github.com/repos/mixxorz/behave-django/issues/comments{/number}","contents_url":"https://api.github.com/repos/mixxorz/behave-django/contents/{+path}","compare_url":"https://api.github.com/repos/mixxorz/behave-django/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mixxorz/behave-django/merges","archive_url":"https://api.github.com/repos/mixxorz/behave-django/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mixxorz/behave-django/downloads","issues_url":"https://api.github.com/repos/mixxorz/behave-django/issues{/number}","pulls_url":"https://api.github.com/repos/mixxorz/behave-django/pulls{/number}","milestones_url":"https://api.github.com/repos/mixxorz/behave-django/milestones{/number}","notifications_url":"https://api.github.com/repos/mixxorz/behave-django/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mixxorz/behave-django/labels{/name}","releases_url":"https://api.github.com/repos/mixxorz/behave-django/releases{/id}","created_at":"2015-04-01T13:37:20Z","updated_at":"2015-06-20T08:52:57Z","pushed_at":"2015-06-22T13:05:20Z","git_url":"git://github.com/mixxorz/behave-django.git","ssh_url":"git@github.com:mixxorz/behave-django.git","clone_url":"https://github.com/mixxorz/behave-django.git","svn_url":"https://github.com/mixxorz/behave-django","homepage":"https://pythonhosted.org/behave-django/","size":594,"stargazers_count":24,"watchers_count":24,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":7,"forks":3,"open_issues":7,"watchers":24,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mixxorz/behave-django/pulls/28"},"html":{"href":"https://github.com/mixxorz/behave-django/pull/28"},"issue":{"href":"https://api.github.com/repos/mixxorz/behave-django/issues/28"},"comments":{"href":"https://api.github.com/repos/mixxorz/behave-django/issues/28/comments"},"review_comments":{"href":"https://api.github.com/repos/mixxorz/behave-django/pulls/28/comments"},"review_comment":{"href":"https://api.github.com/repos/mixxorz/behave-django/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mixxorz/behave-django/pulls/28/commits"},"statuses":{"href":"https://api.github.com/repos/mixxorz/behave-django/statuses/fd82dd67d287af13c2ecf996d4b32e95667a9dc8"}}}}