{"action":"created","comment":{"url":"https://api.github.com/repos/ros2/launch/pulls/comments/45001859","id":45001859,"diff_hunk":"@@ -0,0 +1,61 @@\n+import io\n+import re\n+from launch.output_handler import LineOutput\n+\n+\n+class InMemoryHandler(LineOutput):\n+\n+    def __init__(\n+        self, name, ld, expected_lines, regex_match=False,\n+        filtered_prefixes=[\n+            b'pid', b'rc',\n+            b'RTI Data Distribution Service Evaluation License issued to',\n+            b'Expires on']):\n+        super(LineOutput, self).__init__()\n+        self.name = name\n+        self.ld = ld\n+        self.expected_lines = expected_lines\n+        self.killed = False\n+        self.left_over_stdout = b''\n+        self.left_over_stderr = b''\n+        self.stdout_data = io.BytesIO()\n+        self.stderr_data = io.BytesIO()\n+        self.regex_match = regex_match\n+        self.matched = False\n+        self.filtered_prefixes = filtered_prefixes\n+\n+    def on_stdout_lines(self, lines):\n+        if self.killed:\n+            return\n+\n+        for line in lines.splitlines():\n+            # Filter out stdout that comes from underlying DDS implementations\n+            if any([line.startswith(prefix) for prefix in self.filtered_prefixes]):\n+                continue\n+            self.stdout_data.write(line + b'\\n')\n+\n+            # Are we ready to quit?\n+            if self.regex_match:\n+                self.matched = re.match(self.expected_lines[0], line)\n+            else:\n+                output_lines = self.stdout_data.getvalue().splitlines()\n+                self.matched = output_lines == self.expected_lines","path":"launch_testing/launch_testing/__init__.py","position":53,"original_position":42,"commit_id":"253798b56f097f0cae4899118941d934f5c54cb9","original_commit_id":"b26674b0be512c9272fc4618831f776eed3b3467","user":{"login":"esteve","id":33620,"avatar_url":"https://avatars.githubusercontent.com/u/33620?v=3","gravatar_id":"","url":"https://api.github.com/users/esteve","html_url":"https://github.com/esteve","followers_url":"https://api.github.com/users/esteve/followers","following_url":"https://api.github.com/users/esteve/following{/other_user}","gists_url":"https://api.github.com/users/esteve/gists{/gist_id}","starred_url":"https://api.github.com/users/esteve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esteve/subscriptions","organizations_url":"https://api.github.com/users/esteve/orgs","repos_url":"https://api.github.com/users/esteve/repos","events_url":"https://api.github.com/users/esteve/events{/privacy}","received_events_url":"https://api.github.com/users/esteve/received_events","type":"User","site_admin":false},"body":"Agreed. I added a docstring to document this behavior.","created_at":"2015-11-16T23:34:51Z","updated_at":"2015-11-16T23:34:51Z","html_url":"https://github.com/ros2/launch/pull/13#discussion_r45001859","pull_request_url":"https://api.github.com/repos/ros2/launch/pulls/13","_links":{"self":{"href":"https://api.github.com/repos/ros2/launch/pulls/comments/45001859"},"html":{"href":"https://github.com/ros2/launch/pull/13#discussion_r45001859"},"pull_request":{"href":"https://api.github.com/repos/ros2/launch/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/ros2/launch/pulls/13","id":50868504,"html_url":"https://github.com/ros2/launch/pull/13","diff_url":"https://github.com/ros2/launch/pull/13.diff","patch_url":"https://github.com/ros2/launch/pull/13.patch","issue_url":"https://api.github.com/repos/ros2/launch/issues/13","number":13,"state":"open","locked":false,"title":"Added launch_testing package","user":{"login":"esteve","id":33620,"avatar_url":"https://avatars.githubusercontent.com/u/33620?v=3","gravatar_id":"","url":"https://api.github.com/users/esteve","html_url":"https://github.com/esteve","followers_url":"https://api.github.com/users/esteve/followers","following_url":"https://api.github.com/users/esteve/following{/other_user}","gists_url":"https://api.github.com/users/esteve/gists{/gist_id}","starred_url":"https://api.github.com/users/esteve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esteve/subscriptions","organizations_url":"https://api.github.com/users/esteve/orgs","repos_url":"https://api.github.com/users/esteve/repos","events_url":"https://api.github.com/users/esteve/events{/privacy}","received_events_url":"https://api.github.com/users/esteve/received_events","type":"User","site_admin":false},"body":"This PR adds a handler that can check that a process has produced output that matches a predefined string or a regular expression.","created_at":"2015-11-16T21:27:10Z","updated_at":"2015-11-16T23:34:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cd46a34e515064c0e65942f7f7ea93085351b75f","assignee":{"login":"esteve","id":33620,"avatar_url":"https://avatars.githubusercontent.com/u/33620?v=3","gravatar_id":"","url":"https://api.github.com/users/esteve","html_url":"https://github.com/esteve","followers_url":"https://api.github.com/users/esteve/followers","following_url":"https://api.github.com/users/esteve/following{/other_user}","gists_url":"https://api.github.com/users/esteve/gists{/gist_id}","starred_url":"https://api.github.com/users/esteve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esteve/subscriptions","organizations_url":"https://api.github.com/users/esteve/orgs","repos_url":"https://api.github.com/users/esteve/repos","events_url":"https://api.github.com/users/esteve/events{/privacy}","received_events_url":"https://api.github.com/users/esteve/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/ros2/launch/pulls/13/commits","review_comments_url":"https://api.github.com/repos/ros2/launch/pulls/13/comments","review_comment_url":"https://api.github.com/repos/ros2/launch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ros2/launch/issues/13/comments","statuses_url":"https://api.github.com/repos/ros2/launch/statuses/253798b56f097f0cae4899118941d934f5c54cb9","head":{"label":"ros2:launch_testing","ref":"launch_testing","sha":"253798b56f097f0cae4899118941d934f5c54cb9","user":{"login":"ros2","id":3979232,"avatar_url":"https://avatars.githubusercontent.com/u/3979232?v=3","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"repo":{"id":32485326,"name":"launch","full_name":"ros2/launch","owner":{"login":"ros2","id":3979232,"avatar_url":"https://avatars.githubusercontent.com/u/3979232?v=3","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ros2/launch","description":"","fork":false,"url":"https://api.github.com/repos/ros2/launch","forks_url":"https://api.github.com/repos/ros2/launch/forks","keys_url":"https://api.github.com/repos/ros2/launch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ros2/launch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ros2/launch/teams","hooks_url":"https://api.github.com/repos/ros2/launch/hooks","issue_events_url":"https://api.github.com/repos/ros2/launch/issues/events{/number}","events_url":"https://api.github.com/repos/ros2/launch/events","assignees_url":"https://api.github.com/repos/ros2/launch/assignees{/user}","branches_url":"https://api.github.com/repos/ros2/launch/branches{/branch}","tags_url":"https://api.github.com/repos/ros2/launch/tags","blobs_url":"https://api.github.com/repos/ros2/launch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ros2/launch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ros2/launch/git/refs{/sha}","trees_url":"https://api.github.com/repos/ros2/launch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ros2/launch/statuses/{sha}","languages_url":"https://api.github.com/repos/ros2/launch/languages","stargazers_url":"https://api.github.com/repos/ros2/launch/stargazers","contributors_url":"https://api.github.com/repos/ros2/launch/contributors","subscribers_url":"https://api.github.com/repos/ros2/launch/subscribers","subscription_url":"https://api.github.com/repos/ros2/launch/subscription","commits_url":"https://api.github.com/repos/ros2/launch/commits{/sha}","git_commits_url":"https://api.github.com/repos/ros2/launch/git/commits{/sha}","comments_url":"https://api.github.com/repos/ros2/launch/comments{/number}","issue_comment_url":"https://api.github.com/repos/ros2/launch/issues/comments{/number}","contents_url":"https://api.github.com/repos/ros2/launch/contents/{+path}","compare_url":"https://api.github.com/repos/ros2/launch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ros2/launch/merges","archive_url":"https://api.github.com/repos/ros2/launch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ros2/launch/downloads","issues_url":"https://api.github.com/repos/ros2/launch/issues{/number}","pulls_url":"https://api.github.com/repos/ros2/launch/pulls{/number}","milestones_url":"https://api.github.com/repos/ros2/launch/milestones{/number}","notifications_url":"https://api.github.com/repos/ros2/launch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ros2/launch/labels{/name}","releases_url":"https://api.github.com/repos/ros2/launch/releases{/id}","created_at":"2015-03-18T21:27:58Z","updated_at":"2015-06-12T21:17:24Z","pushed_at":"2015-11-16T23:34:33Z","git_url":"git://github.com/ros2/launch.git","ssh_url":"git@github.com:ros2/launch.git","clone_url":"https://github.com/ros2/launch.git","svn_url":"https://github.com/ros2/launch","homepage":null,"size":46,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":1,"default_branch":"master"}},"base":{"label":"ros2:master","ref":"master","sha":"7409aa1a64942a916a3be75177cd4c50249a8b32","user":{"login":"ros2","id":3979232,"avatar_url":"https://avatars.githubusercontent.com/u/3979232?v=3","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"repo":{"id":32485326,"name":"launch","full_name":"ros2/launch","owner":{"login":"ros2","id":3979232,"avatar_url":"https://avatars.githubusercontent.com/u/3979232?v=3","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ros2/launch","description":"","fork":false,"url":"https://api.github.com/repos/ros2/launch","forks_url":"https://api.github.com/repos/ros2/launch/forks","keys_url":"https://api.github.com/repos/ros2/launch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ros2/launch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ros2/launch/teams","hooks_url":"https://api.github.com/repos/ros2/launch/hooks","issue_events_url":"https://api.github.com/repos/ros2/launch/issues/events{/number}","events_url":"https://api.github.com/repos/ros2/launch/events","assignees_url":"https://api.github.com/repos/ros2/launch/assignees{/user}","branches_url":"https://api.github.com/repos/ros2/launch/branches{/branch}","tags_url":"https://api.github.com/repos/ros2/launch/tags","blobs_url":"https://api.github.com/repos/ros2/launch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ros2/launch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ros2/launch/git/refs{/sha}","trees_url":"https://api.github.com/repos/ros2/launch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ros2/launch/statuses/{sha}","languages_url":"https://api.github.com/repos/ros2/launch/languages","stargazers_url":"https://api.github.com/repos/ros2/launch/stargazers","contributors_url":"https://api.github.com/repos/ros2/launch/contributors","subscribers_url":"https://api.github.com/repos/ros2/launch/subscribers","subscription_url":"https://api.github.com/repos/ros2/launch/subscription","commits_url":"https://api.github.com/repos/ros2/launch/commits{/sha}","git_commits_url":"https://api.github.com/repos/ros2/launch/git/commits{/sha}","comments_url":"https://api.github.com/repos/ros2/launch/comments{/number}","issue_comment_url":"https://api.github.com/repos/ros2/launch/issues/comments{/number}","contents_url":"https://api.github.com/repos/ros2/launch/contents/{+path}","compare_url":"https://api.github.com/repos/ros2/launch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ros2/launch/merges","archive_url":"https://api.github.com/repos/ros2/launch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ros2/launch/downloads","issues_url":"https://api.github.com/repos/ros2/launch/issues{/number}","pulls_url":"https://api.github.com/repos/ros2/launch/pulls{/number}","milestones_url":"https://api.github.com/repos/ros2/launch/milestones{/number}","notifications_url":"https://api.github.com/repos/ros2/launch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ros2/launch/labels{/name}","releases_url":"https://api.github.com/repos/ros2/launch/releases{/id}","created_at":"2015-03-18T21:27:58Z","updated_at":"2015-06-12T21:17:24Z","pushed_at":"2015-11-16T23:34:33Z","git_url":"git://github.com/ros2/launch.git","ssh_url":"git@github.com:ros2/launch.git","clone_url":"https://github.com/ros2/launch.git","svn_url":"https://github.com/ros2/launch","homepage":null,"size":46,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ros2/launch/pulls/13"},"html":{"href":"https://github.com/ros2/launch/pull/13"},"issue":{"href":"https://api.github.com/repos/ros2/launch/issues/13"},"comments":{"href":"https://api.github.com/repos/ros2/launch/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/ros2/launch/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/ros2/launch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ros2/launch/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/ros2/launch/statuses/253798b56f097f0cae4899118941d934f5c54cb9"}}}}