{"action":"created","comment":{"url":"https://api.github.com/repos/timvideos/gst-switch/pulls/comments/29584521","id":29584521,"diff_hunk":"@@ -0,0 +1,157 @@\n+\"\"\"\n+The ProcessMonitor runs a command in a background thread and monitors\n+its output- It can block until the command prints a certain string and\n+log the full output into a file\n+\"\"\"\n+\n+from __future__ import absolute_import, print_function, unicode_literals\n+\n+import subprocess\n+import logging\n+import sys\n+import os\n+import time\n+import select\n+\n+from .exception import ServerProcessError\n+from .exception import MatchTimeoutError, MatchEofError, SelectError\n+\n+\n+class ProcessMonitor(subprocess.Popen):\n+    \"\"\"Runs a command in a background-thread and monitors its output\n+\n+    Can block until the command prints a certain string and log the full\n+    output into a file\n+    \"\"\"\n+\n+    def __init__(self, cmd, cmd_output_target=sys.stderr):\n+        self.log = logging.getLogger('server-output-monitor')\n+\n+        # Logfile to write to\n+        self._cmd_output_target = cmd_output_target\n+\n+        # Internal Buffer to search for matched when wait_for_output is called\n+        self._buffer = \"\"\n+\n+        self.log.debug(\"starting subprocess\")\n+\n+        try:\n+            super(ProcessMonitor, self).__init__(\n+                cmd,\n+                stdout=subprocess.PIPE,\n+                stderr=subprocess.STDOUT,\n+                bufsize=0,\n+                shell=False)\n+        except Exception as err:\n+            raise ServerProcessError(err)\n+\n+        self.log.debug(\"subprocess successfully started\")\n+\n+    def terminate(self):","path":"python-api/gstswitch/process_monitor.py","position":50,"original_position":50,"commit_id":"b7ad78000f711dc0647382b16c20cc2c11c5a007","original_commit_id":"06c94ff44c614cfe0dd3b3a45c5c1e9fac232ef4","user":{"login":"MaZderMind","id":142237,"avatar_url":"https://avatars.githubusercontent.com/u/142237?v=3","gravatar_id":"","url":"https://api.github.com/users/MaZderMind","html_url":"https://github.com/MaZderMind","followers_url":"https://api.github.com/users/MaZderMind/followers","following_url":"https://api.github.com/users/MaZderMind/following{/other_user}","gists_url":"https://api.github.com/users/MaZderMind/gists{/gist_id}","starred_url":"https://api.github.com/users/MaZderMind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaZderMind/subscriptions","organizations_url":"https://api.github.com/users/MaZderMind/orgs","repos_url":"https://api.github.com/users/MaZderMind/repos","events_url":"https://api.github.com/users/MaZderMind/events{/privacy}","received_events_url":"https://api.github.com/users/MaZderMind/received_events","type":"User","site_admin":false},"body":"done.","created_at":"2015-05-04T13:41:09Z","updated_at":"2015-05-04T13:41:09Z","html_url":"https://github.com/timvideos/gst-switch/pull/198#discussion_r29584521","pull_request_url":"https://api.github.com/repos/timvideos/gst-switch/pulls/198","_links":{"self":{"href":"https://api.github.com/repos/timvideos/gst-switch/pulls/comments/29584521"},"html":{"href":"https://github.com/timvideos/gst-switch/pull/198#discussion_r29584521"},"pull_request":{"href":"https://api.github.com/repos/timvideos/gst-switch/pulls/198"}}},"pull_request":{"url":"https://api.github.com/repos/timvideos/gst-switch/pulls/198","id":29602368,"html_url":"https://github.com/timvideos/gst-switch/pull/198","diff_url":"https://github.com/timvideos/gst-switch/pull/198.diff","patch_url":"https://github.com/timvideos/gst-switch/pull/198.patch","issue_url":"https://api.github.com/repos/timvideos/gst-switch/issues/198","number":198,"state":"open","locked":false,"title":"Rewriting the integration tests to make them reliable and easier to understand","user":{"login":"MaZderMind","id":142237,"avatar_url":"https://avatars.githubusercontent.com/u/142237?v=3","gravatar_id":"","url":"https://api.github.com/users/MaZderMind","html_url":"https://github.com/MaZderMind","followers_url":"https://api.github.com/users/MaZderMind/followers","following_url":"https://api.github.com/users/MaZderMind/following{/other_user}","gists_url":"https://api.github.com/users/MaZderMind/gists{/gist_id}","starred_url":"https://api.github.com/users/MaZderMind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaZderMind/subscriptions","organizations_url":"https://api.github.com/users/MaZderMind/orgs","repos_url":"https://api.github.com/users/MaZderMind/repos","events_url":"https://api.github.com/users/MaZderMind/events{/privacy}","received_events_url":"https://api.github.com/users/MaZderMind/received_events","type":"User","site_admin":false},"body":"These changes introduce a cleaner, reliable and more complete set of integration tests increasing unit test coverage to >99%.\r\n\r\nIt creates a new common testing base system, which does not rely on sleeping n-seconds (to give the server time to start) but instead closely monitors the server's stdout to know when the server is ready for a specific test to begin. This way the tests run much faster and don't rely on the speed of the running machine. This should greatly improve overall test reliability, especially on highly variable environments like Travis-CI. \r\n\r\nTests which continue to have problems after this change are marked as @xfail and reference GitHub-Issues about why the tests fail.\r\n\r\nThis pull request closes the following open issues;\r\n * Closes #179 - The test `test_get_preview_ports` sporadically fails.\r\n * Closes #178 - Failure in `test_set_composite_mode_preview`.\r\n * Closes #180 - Server exiting with exit code -5\r\n * Closes #173 - Errors when running `make test`\r\n * Closes #170 - `NUM` and `FACTOR` stuff in test_controller is incomprehensible\r\n * Closes #166 - Integration tests should use pyvirtualdisplay or similar module\r\n * Closes #37 - Replace ffmpeg / avcon usage in the integration tests with gstreamer.\r\n * Closes #159 - Cleanup Python-API unit test output\r\n * Closes #17 - Move to some type of pre-built test runner\r\n * Closes #2 - Test timer should use average test run time","created_at":"2015-02-19T11:04:07Z","updated_at":"2015-05-04T13:41:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"422a17db379e582545bd3338b6cd2d6313b228f1","assignee":{"login":"mithro","id":21212,"avatar_url":"https://avatars.githubusercontent.com/u/21212?v=3","gravatar_id":"","url":"https://api.github.com/users/mithro","html_url":"https://github.com/mithro","followers_url":"https://api.github.com/users/mithro/followers","following_url":"https://api.github.com/users/mithro/following{/other_user}","gists_url":"https://api.github.com/users/mithro/gists{/gist_id}","starred_url":"https://api.github.com/users/mithro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mithro/subscriptions","organizations_url":"https://api.github.com/users/mithro/orgs","repos_url":"https://api.github.com/users/mithro/repos","events_url":"https://api.github.com/users/mithro/events{/privacy}","received_events_url":"https://api.github.com/users/mithro/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/timvideos/gst-switch/pulls/198/commits","review_comments_url":"https://api.github.com/repos/timvideos/gst-switch/pulls/198/comments","review_comment_url":"https://api.github.com/repos/timvideos/gst-switch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/timvideos/gst-switch/issues/198/comments","statuses_url":"https://api.github.com/repos/timvideos/gst-switch/statuses/b7ad78000f711dc0647382b16c20cc2c11c5a007","head":{"label":"MaZderMind:int-tests-rewrite2","ref":"int-tests-rewrite2","sha":"b7ad78000f711dc0647382b16c20cc2c11c5a007","user":{"login":"MaZderMind","id":142237,"avatar_url":"https://avatars.githubusercontent.com/u/142237?v=3","gravatar_id":"","url":"https://api.github.com/users/MaZderMind","html_url":"https://github.com/MaZderMind","followers_url":"https://api.github.com/users/MaZderMind/followers","following_url":"https://api.github.com/users/MaZderMind/following{/other_user}","gists_url":"https://api.github.com/users/MaZderMind/gists{/gist_id}","starred_url":"https://api.github.com/users/MaZderMind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaZderMind/subscriptions","organizations_url":"https://api.github.com/users/MaZderMind/orgs","repos_url":"https://api.github.com/users/MaZderMind/repos","events_url":"https://api.github.com/users/MaZderMind/events{/privacy}","received_events_url":"https://api.github.com/users/MaZderMind/received_events","type":"User","site_admin":false},"repo":{"id":28911980,"name":"gst-switch","full_name":"MaZderMind/gst-switch","owner":{"login":"MaZderMind","id":142237,"avatar_url":"https://avatars.githubusercontent.com/u/142237?v=3","gravatar_id":"","url":"https://api.github.com/users/MaZderMind","html_url":"https://github.com/MaZderMind","followers_url":"https://api.github.com/users/MaZderMind/followers","following_url":"https://api.github.com/users/MaZderMind/following{/other_user}","gists_url":"https://api.github.com/users/MaZderMind/gists{/gist_id}","starred_url":"https://api.github.com/users/MaZderMind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaZderMind/subscriptions","organizations_url":"https://api.github.com/users/MaZderMind/orgs","repos_url":"https://api.github.com/users/MaZderMind/repos","events_url":"https://api.github.com/users/MaZderMind/events{/privacy}","received_events_url":"https://api.github.com/users/MaZderMind/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MaZderMind/gst-switch","description":"A DVswitch replacement basing on GStreamer.","fork":true,"url":"https://api.github.com/repos/MaZderMind/gst-switch","forks_url":"https://api.github.com/repos/MaZderMind/gst-switch/forks","keys_url":"https://api.github.com/repos/MaZderMind/gst-switch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MaZderMind/gst-switch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MaZderMind/gst-switch/teams","hooks_url":"https://api.github.com/repos/MaZderMind/gst-switch/hooks","issue_events_url":"https://api.github.com/repos/MaZderMind/gst-switch/issues/events{/number}","events_url":"https://api.github.com/repos/MaZderMind/gst-switch/events","assignees_url":"https://api.github.com/repos/MaZderMind/gst-switch/assignees{/user}","branches_url":"https://api.github.com/repos/MaZderMind/gst-switch/branches{/branch}","tags_url":"https://api.github.com/repos/MaZderMind/gst-switch/tags","blobs_url":"https://api.github.com/repos/MaZderMind/gst-switch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MaZderMind/gst-switch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MaZderMind/gst-switch/git/refs{/sha}","trees_url":"https://api.github.com/repos/MaZderMind/gst-switch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MaZderMind/gst-switch/statuses/{sha}","languages_url":"https://api.github.com/repos/MaZderMind/gst-switch/languages","stargazers_url":"https://api.github.com/repos/MaZderMind/gst-switch/stargazers","contributors_url":"https://api.github.com/repos/MaZderMind/gst-switch/contributors","subscribers_url":"https://api.github.com/repos/MaZderMind/gst-switch/subscribers","subscription_url":"https://api.github.com/repos/MaZderMind/gst-switch/subscription","commits_url":"https://api.github.com/repos/MaZderMind/gst-switch/commits{/sha}","git_commits_url":"https://api.github.com/repos/MaZderMind/gst-switch/git/commits{/sha}","comments_url":"https://api.github.com/repos/MaZderMind/gst-switch/comments{/number}","issue_comment_url":"https://api.github.com/repos/MaZderMind/gst-switch/issues/comments{/number}","contents_url":"https://api.github.com/repos/MaZderMind/gst-switch/contents/{+path}","compare_url":"https://api.github.com/repos/MaZderMind/gst-switch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MaZderMind/gst-switch/merges","archive_url":"https://api.github.com/repos/MaZderMind/gst-switch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MaZderMind/gst-switch/downloads","issues_url":"https://api.github.com/repos/MaZderMind/gst-switch/issues{/number}","pulls_url":"https://api.github.com/repos/MaZderMind/gst-switch/pulls{/number}","milestones_url":"https://api.github.com/repos/MaZderMind/gst-switch/milestones{/number}","notifications_url":"https://api.github.com/repos/MaZderMind/gst-switch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MaZderMind/gst-switch/labels{/name}","releases_url":"https://api.github.com/repos/MaZderMind/gst-switch/releases{/id}","created_at":"2015-01-07T11:38:59Z","updated_at":"2015-02-22T22:58:52Z","pushed_at":"2015-05-04T12:52:41Z","git_url":"git://github.com/MaZderMind/gst-switch.git","ssh_url":"git@github.com:MaZderMind/gst-switch.git","clone_url":"https://github.com/MaZderMind/gst-switch.git","svn_url":"https://github.com/MaZderMind/gst-switch","homepage":null,"size":3622,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"timvideos:master","ref":"master","sha":"a0f8a384844cbd829b6cacd7cbe5020bb4678978","user":{"login":"timvideos","id":811205,"avatar_url":"https://avatars.githubusercontent.com/u/811205?v=3","gravatar_id":"","url":"https://api.github.com/users/timvideos","html_url":"https://github.com/timvideos","followers_url":"https://api.github.com/users/timvideos/followers","following_url":"https://api.github.com/users/timvideos/following{/other_user}","gists_url":"https://api.github.com/users/timvideos/gists{/gist_id}","starred_url":"https://api.github.com/users/timvideos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timvideos/subscriptions","organizations_url":"https://api.github.com/users/timvideos/orgs","repos_url":"https://api.github.com/users/timvideos/repos","events_url":"https://api.github.com/users/timvideos/events{/privacy}","received_events_url":"https://api.github.com/users/timvideos/received_events","type":"Organization","site_admin":false},"repo":{"id":7572862,"name":"gst-switch","full_name":"timvideos/gst-switch","owner":{"login":"timvideos","id":811205,"avatar_url":"https://avatars.githubusercontent.com/u/811205?v=3","gravatar_id":"","url":"https://api.github.com/users/timvideos","html_url":"https://github.com/timvideos","followers_url":"https://api.github.com/users/timvideos/followers","following_url":"https://api.github.com/users/timvideos/following{/other_user}","gists_url":"https://api.github.com/users/timvideos/gists{/gist_id}","starred_url":"https://api.github.com/users/timvideos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timvideos/subscriptions","organizations_url":"https://api.github.com/users/timvideos/orgs","repos_url":"https://api.github.com/users/timvideos/repos","events_url":"https://api.github.com/users/timvideos/events{/privacy}","received_events_url":"https://api.github.com/users/timvideos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/timvideos/gst-switch","description":"A DVswitch replacement basing on GStreamer.","fork":true,"url":"https://api.github.com/repos/timvideos/gst-switch","forks_url":"https://api.github.com/repos/timvideos/gst-switch/forks","keys_url":"https://api.github.com/repos/timvideos/gst-switch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/timvideos/gst-switch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/timvideos/gst-switch/teams","hooks_url":"https://api.github.com/repos/timvideos/gst-switch/hooks","issue_events_url":"https://api.github.com/repos/timvideos/gst-switch/issues/events{/number}","events_url":"https://api.github.com/repos/timvideos/gst-switch/events","assignees_url":"https://api.github.com/repos/timvideos/gst-switch/assignees{/user}","branches_url":"https://api.github.com/repos/timvideos/gst-switch/branches{/branch}","tags_url":"https://api.github.com/repos/timvideos/gst-switch/tags","blobs_url":"https://api.github.com/repos/timvideos/gst-switch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/timvideos/gst-switch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/timvideos/gst-switch/git/refs{/sha}","trees_url":"https://api.github.com/repos/timvideos/gst-switch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/timvideos/gst-switch/statuses/{sha}","languages_url":"https://api.github.com/repos/timvideos/gst-switch/languages","stargazers_url":"https://api.github.com/repos/timvideos/gst-switch/stargazers","contributors_url":"https://api.github.com/repos/timvideos/gst-switch/contributors","subscribers_url":"https://api.github.com/repos/timvideos/gst-switch/subscribers","subscription_url":"https://api.github.com/repos/timvideos/gst-switch/subscription","commits_url":"https://api.github.com/repos/timvideos/gst-switch/commits{/sha}","git_commits_url":"https://api.github.com/repos/timvideos/gst-switch/git/commits{/sha}","comments_url":"https://api.github.com/repos/timvideos/gst-switch/comments{/number}","issue_comment_url":"https://api.github.com/repos/timvideos/gst-switch/issues/comments{/number}","contents_url":"https://api.github.com/repos/timvideos/gst-switch/contents/{+path}","compare_url":"https://api.github.com/repos/timvideos/gst-switch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/timvideos/gst-switch/merges","archive_url":"https://api.github.com/repos/timvideos/gst-switch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/timvideos/gst-switch/downloads","issues_url":"https://api.github.com/repos/timvideos/gst-switch/issues{/number}","pulls_url":"https://api.github.com/repos/timvideos/gst-switch/pulls{/number}","milestones_url":"https://api.github.com/repos/timvideos/gst-switch/milestones{/number}","notifications_url":"https://api.github.com/repos/timvideos/gst-switch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/timvideos/gst-switch/labels{/name}","releases_url":"https://api.github.com/repos/timvideos/gst-switch/releases{/id}","created_at":"2013-01-12T07:31:28Z","updated_at":"2015-04-23T08:03:52Z","pushed_at":"2015-05-04T13:03:45Z","git_url":"git://github.com/timvideos/gst-switch.git","ssh_url":"git@github.com:timvideos/gst-switch.git","clone_url":"https://github.com/timvideos/gst-switch.git","svn_url":"https://github.com/timvideos/gst-switch","homepage":null,"size":4986,"stargazers_count":22,"watchers_count":22,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":84,"forks":8,"open_issues":84,"watchers":22,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/timvideos/gst-switch/pulls/198"},"html":{"href":"https://github.com/timvideos/gst-switch/pull/198"},"issue":{"href":"https://api.github.com/repos/timvideos/gst-switch/issues/198"},"comments":{"href":"https://api.github.com/repos/timvideos/gst-switch/issues/198/comments"},"review_comments":{"href":"https://api.github.com/repos/timvideos/gst-switch/pulls/198/comments"},"review_comment":{"href":"https://api.github.com/repos/timvideos/gst-switch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/timvideos/gst-switch/pulls/198/commits"},"statuses":{"href":"https://api.github.com/repos/timvideos/gst-switch/statuses/b7ad78000f711dc0647382b16c20cc2c11c5a007"}}}}