{"action":"created","comment":{"url":"https://api.github.com/repos/njoyce/biloba/pulls/comments/22692413","id":22692413,"diff_hunk":"@@ -462,3 +462,53 @@ def test_biloba_config(self):\n         svc = service.ConfigurableService(cfg)\n \n         self.assertIs(svc.config, cfg)\n+\n+\n+class AutospawnTestCase(unittest.TestCase):\n+    \"\"\"\n+    Tests for `service.autospawn`.\n+    \"\"\"\n+\n+    def test_started(self):\n+        class MyService(service.Service):\n+            @service.autospawn\n+            def my_func(self):\n+                self.emit('autospawn')\n+\n+        my_service = MyService()\n+        self.executed = False\n+\n+        @my_service.on('autospawn')\n+        def on_autospawn():\n+            self.assertTrue(my_service.started)\n+            self.executed = True\n+\n+        with my_service:\n+            ret = my_service.my_func()\n+\n+            self.assertIsNone(ret)\n+\n+        self.assertTrue(self.executed)\n+\n+    def test_not_started(self):\n+        class MyService(service.Service):\n+            @service.autospawn\n+            def my_func(self):\n+                self.emit('autospawn')\n+\n+        my_service = MyService()\n+        self.executed = False\n+\n+        @my_service.on('autospawn')\n+        def on_autospawn():\n+            self.assertTrue(my_service.started)\n+            self.executed = True\n+\n+        ret = my_service.my_func()\n+\n+        self.assertIsNone(ret)\n+\n+        self.assertFalse(self.executed)\n+\n+        with my_service:\n+            self.assertTrue(self.executed)","path":"biloba/test/test_service.py","position":53,"original_position":53,"commit_id":"bd7a5a0b716639f494463c63ea8b961bda6ae513","original_commit_id":"bd7a5a0b716639f494463c63ea8b961bda6ae513","user":{"login":"kevinfrommelt-wf","id":3324904,"avatar_url":"https://avatars.githubusercontent.com/u/3324904?v=3","gravatar_id":"","url":"https://api.github.com/users/kevinfrommelt-wf","html_url":"https://github.com/kevinfrommelt-wf","followers_url":"https://api.github.com/users/kevinfrommelt-wf/followers","following_url":"https://api.github.com/users/kevinfrommelt-wf/following{/other_user}","gists_url":"https://api.github.com/users/kevinfrommelt-wf/gists{/gist_id}","starred_url":"https://api.github.com/users/kevinfrommelt-wf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevinfrommelt-wf/subscriptions","organizations_url":"https://api.github.com/users/kevinfrommelt-wf/orgs","repos_url":"https://api.github.com/users/kevinfrommelt-wf/repos","events_url":"https://api.github.com/users/kevinfrommelt-wf/events{/privacy}","received_events_url":"https://api.github.com/users/kevinfrommelt-wf/received_events","type":"User","site_admin":false},"body":"Should you add another test to make sure it executes once the service is started?","created_at":"2015-01-08T23:43:11Z","updated_at":"2015-01-08T23:43:11Z","html_url":"https://github.com/njoyce/biloba/pull/5#discussion_r22692413","pull_request_url":"https://api.github.com/repos/njoyce/biloba/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/njoyce/biloba/pulls/comments/22692413"},"html":{"href":"https://github.com/njoyce/biloba/pull/5#discussion_r22692413"},"pull_request":{"href":"https://api.github.com/repos/njoyce/biloba/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/njoyce/biloba/pulls/5","id":27066390,"html_url":"https://github.com/njoyce/biloba/pull/5","diff_url":"https://github.com/njoyce/biloba/pull/5.diff","patch_url":"https://github.com/njoyce/biloba/pull/5.patch","issue_url":"https://api.github.com/repos/njoyce/biloba/issues/5","number":5,"state":"open","locked":false,"title":"Add autospawn decorator","user":{"login":"nickjoyce-wf","id":1444666,"avatar_url":"https://avatars.githubusercontent.com/u/1444666?v=3","gravatar_id":"","url":"https://api.github.com/users/nickjoyce-wf","html_url":"https://github.com/nickjoyce-wf","followers_url":"https://api.github.com/users/nickjoyce-wf/followers","following_url":"https://api.github.com/users/nickjoyce-wf/following{/other_user}","gists_url":"https://api.github.com/users/nickjoyce-wf/gists{/gist_id}","starred_url":"https://api.github.com/users/nickjoyce-wf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickjoyce-wf/subscriptions","organizations_url":"https://api.github.com/users/nickjoyce-wf/orgs","repos_url":"https://api.github.com/users/nickjoyce-wf/repos","events_url":"https://api.github.com/users/nickjoyce-wf/events{/privacy}","received_events_url":"https://api.github.com/users/nickjoyce-wf/received_events","type":"User","site_admin":false},"body":"Allow method calls on services to automatically be executed in the service's greenlet\r\npool.","created_at":"2015-01-08T22:44:29Z","updated_at":"2015-01-08T23:43:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"79f4871183993cf466ecaa273113a868b92130b8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/njoyce/biloba/pulls/5/commits","review_comments_url":"https://api.github.com/repos/njoyce/biloba/pulls/5/comments","review_comment_url":"https://api.github.com/repos/njoyce/biloba/pulls/comments/{number}","comments_url":"https://api.github.com/repos/njoyce/biloba/issues/5/comments","statuses_url":"https://api.github.com/repos/njoyce/biloba/statuses/bd7a5a0b716639f494463c63ea8b961bda6ae513","head":{"label":"njoyce:autospawn","ref":"autospawn","sha":"bd7a5a0b716639f494463c63ea8b961bda6ae513","user":{"login":"njoyce","id":56383,"avatar_url":"https://avatars.githubusercontent.com/u/56383?v=3","gravatar_id":"","url":"https://api.github.com/users/njoyce","html_url":"https://github.com/njoyce","followers_url":"https://api.github.com/users/njoyce/followers","following_url":"https://api.github.com/users/njoyce/following{/other_user}","gists_url":"https://api.github.com/users/njoyce/gists{/gist_id}","starred_url":"https://api.github.com/users/njoyce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njoyce/subscriptions","organizations_url":"https://api.github.com/users/njoyce/orgs","repos_url":"https://api.github.com/users/njoyce/repos","events_url":"https://api.github.com/users/njoyce/events{/privacy}","received_events_url":"https://api.github.com/users/njoyce/received_events","type":"User","site_admin":false},"repo":{"id":15821975,"name":"biloba","full_name":"njoyce/biloba","owner":{"login":"njoyce","id":56383,"avatar_url":"https://avatars.githubusercontent.com/u/56383?v=3","gravatar_id":"","url":"https://api.github.com/users/njoyce","html_url":"https://github.com/njoyce","followers_url":"https://api.github.com/users/njoyce/followers","following_url":"https://api.github.com/users/njoyce/following{/other_user}","gists_url":"https://api.github.com/users/njoyce/gists{/gist_id}","starred_url":"https://api.github.com/users/njoyce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njoyce/subscriptions","organizations_url":"https://api.github.com/users/njoyce/orgs","repos_url":"https://api.github.com/users/njoyce/repos","events_url":"https://api.github.com/users/njoyce/events{/privacy}","received_events_url":"https://api.github.com/users/njoyce/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/njoyce/biloba","description":"Provides gevent primitives to orchestrate different orthogonal servers and services together.","fork":false,"url":"https://api.github.com/repos/njoyce/biloba","forks_url":"https://api.github.com/repos/njoyce/biloba/forks","keys_url":"https://api.github.com/repos/njoyce/biloba/keys{/key_id}","collaborators_url":"https://api.github.com/repos/njoyce/biloba/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/njoyce/biloba/teams","hooks_url":"https://api.github.com/repos/njoyce/biloba/hooks","issue_events_url":"https://api.github.com/repos/njoyce/biloba/issues/events{/number}","events_url":"https://api.github.com/repos/njoyce/biloba/events","assignees_url":"https://api.github.com/repos/njoyce/biloba/assignees{/user}","branches_url":"https://api.github.com/repos/njoyce/biloba/branches{/branch}","tags_url":"https://api.github.com/repos/njoyce/biloba/tags","blobs_url":"https://api.github.com/repos/njoyce/biloba/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/njoyce/biloba/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/njoyce/biloba/git/refs{/sha}","trees_url":"https://api.github.com/repos/njoyce/biloba/git/trees{/sha}","statuses_url":"https://api.github.com/repos/njoyce/biloba/statuses/{sha}","languages_url":"https://api.github.com/repos/njoyce/biloba/languages","stargazers_url":"https://api.github.com/repos/njoyce/biloba/stargazers","contributors_url":"https://api.github.com/repos/njoyce/biloba/contributors","subscribers_url":"https://api.github.com/repos/njoyce/biloba/subscribers","subscription_url":"https://api.github.com/repos/njoyce/biloba/subscription","commits_url":"https://api.github.com/repos/njoyce/biloba/commits{/sha}","git_commits_url":"https://api.github.com/repos/njoyce/biloba/git/commits{/sha}","comments_url":"https://api.github.com/repos/njoyce/biloba/comments{/number}","issue_comment_url":"https://api.github.com/repos/njoyce/biloba/issues/comments/{number}","contents_url":"https://api.github.com/repos/njoyce/biloba/contents/{+path}","compare_url":"https://api.github.com/repos/njoyce/biloba/compare/{base}...{head}","merges_url":"https://api.github.com/repos/njoyce/biloba/merges","archive_url":"https://api.github.com/repos/njoyce/biloba/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/njoyce/biloba/downloads","issues_url":"https://api.github.com/repos/njoyce/biloba/issues{/number}","pulls_url":"https://api.github.com/repos/njoyce/biloba/pulls{/number}","milestones_url":"https://api.github.com/repos/njoyce/biloba/milestones{/number}","notifications_url":"https://api.github.com/repos/njoyce/biloba/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/njoyce/biloba/labels{/name}","releases_url":"https://api.github.com/repos/njoyce/biloba/releases{/id}","created_at":"2014-01-11T12:17:05Z","updated_at":"2015-01-08T18:07:20Z","pushed_at":"2015-01-08T23:14:21Z","git_url":"git://github.com/njoyce/biloba.git","ssh_url":"git@github.com:njoyce/biloba.git","clone_url":"https://github.com/njoyce/biloba.git","svn_url":"https://github.com/njoyce/biloba","homepage":null,"size":339,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"njoyce:master","ref":"master","sha":"e80efc495b2d6b6b10df356e0648e27b57f81f68","user":{"login":"njoyce","id":56383,"avatar_url":"https://avatars.githubusercontent.com/u/56383?v=3","gravatar_id":"","url":"https://api.github.com/users/njoyce","html_url":"https://github.com/njoyce","followers_url":"https://api.github.com/users/njoyce/followers","following_url":"https://api.github.com/users/njoyce/following{/other_user}","gists_url":"https://api.github.com/users/njoyce/gists{/gist_id}","starred_url":"https://api.github.com/users/njoyce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njoyce/subscriptions","organizations_url":"https://api.github.com/users/njoyce/orgs","repos_url":"https://api.github.com/users/njoyce/repos","events_url":"https://api.github.com/users/njoyce/events{/privacy}","received_events_url":"https://api.github.com/users/njoyce/received_events","type":"User","site_admin":false},"repo":{"id":15821975,"name":"biloba","full_name":"njoyce/biloba","owner":{"login":"njoyce","id":56383,"avatar_url":"https://avatars.githubusercontent.com/u/56383?v=3","gravatar_id":"","url":"https://api.github.com/users/njoyce","html_url":"https://github.com/njoyce","followers_url":"https://api.github.com/users/njoyce/followers","following_url":"https://api.github.com/users/njoyce/following{/other_user}","gists_url":"https://api.github.com/users/njoyce/gists{/gist_id}","starred_url":"https://api.github.com/users/njoyce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njoyce/subscriptions","organizations_url":"https://api.github.com/users/njoyce/orgs","repos_url":"https://api.github.com/users/njoyce/repos","events_url":"https://api.github.com/users/njoyce/events{/privacy}","received_events_url":"https://api.github.com/users/njoyce/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/njoyce/biloba","description":"Provides gevent primitives to orchestrate different orthogonal servers and services together.","fork":false,"url":"https://api.github.com/repos/njoyce/biloba","forks_url":"https://api.github.com/repos/njoyce/biloba/forks","keys_url":"https://api.github.com/repos/njoyce/biloba/keys{/key_id}","collaborators_url":"https://api.github.com/repos/njoyce/biloba/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/njoyce/biloba/teams","hooks_url":"https://api.github.com/repos/njoyce/biloba/hooks","issue_events_url":"https://api.github.com/repos/njoyce/biloba/issues/events{/number}","events_url":"https://api.github.com/repos/njoyce/biloba/events","assignees_url":"https://api.github.com/repos/njoyce/biloba/assignees{/user}","branches_url":"https://api.github.com/repos/njoyce/biloba/branches{/branch}","tags_url":"https://api.github.com/repos/njoyce/biloba/tags","blobs_url":"https://api.github.com/repos/njoyce/biloba/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/njoyce/biloba/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/njoyce/biloba/git/refs{/sha}","trees_url":"https://api.github.com/repos/njoyce/biloba/git/trees{/sha}","statuses_url":"https://api.github.com/repos/njoyce/biloba/statuses/{sha}","languages_url":"https://api.github.com/repos/njoyce/biloba/languages","stargazers_url":"https://api.github.com/repos/njoyce/biloba/stargazers","contributors_url":"https://api.github.com/repos/njoyce/biloba/contributors","subscribers_url":"https://api.github.com/repos/njoyce/biloba/subscribers","subscription_url":"https://api.github.com/repos/njoyce/biloba/subscription","commits_url":"https://api.github.com/repos/njoyce/biloba/commits{/sha}","git_commits_url":"https://api.github.com/repos/njoyce/biloba/git/commits{/sha}","comments_url":"https://api.github.com/repos/njoyce/biloba/comments{/number}","issue_comment_url":"https://api.github.com/repos/njoyce/biloba/issues/comments/{number}","contents_url":"https://api.github.com/repos/njoyce/biloba/contents/{+path}","compare_url":"https://api.github.com/repos/njoyce/biloba/compare/{base}...{head}","merges_url":"https://api.github.com/repos/njoyce/biloba/merges","archive_url":"https://api.github.com/repos/njoyce/biloba/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/njoyce/biloba/downloads","issues_url":"https://api.github.com/repos/njoyce/biloba/issues{/number}","pulls_url":"https://api.github.com/repos/njoyce/biloba/pulls{/number}","milestones_url":"https://api.github.com/repos/njoyce/biloba/milestones{/number}","notifications_url":"https://api.github.com/repos/njoyce/biloba/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/njoyce/biloba/labels{/name}","releases_url":"https://api.github.com/repos/njoyce/biloba/releases{/id}","created_at":"2014-01-11T12:17:05Z","updated_at":"2015-01-08T18:07:20Z","pushed_at":"2015-01-08T23:14:21Z","git_url":"git://github.com/njoyce/biloba.git","ssh_url":"git@github.com:njoyce/biloba.git","clone_url":"https://github.com/njoyce/biloba.git","svn_url":"https://github.com/njoyce/biloba","homepage":null,"size":339,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/njoyce/biloba/pulls/5"},"html":{"href":"https://github.com/njoyce/biloba/pull/5"},"issue":{"href":"https://api.github.com/repos/njoyce/biloba/issues/5"},"comments":{"href":"https://api.github.com/repos/njoyce/biloba/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/njoyce/biloba/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/njoyce/biloba/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/njoyce/biloba/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/njoyce/biloba/statuses/bd7a5a0b716639f494463c63ea8b961bda6ae513"}}}}