{"action":"created","comment":{"url":"https://api.github.com/repos/evansde77/cirrus/pulls/comments/71413123","id":71413123,"diff_hunk":"@@ -0,0 +1,188 @@\n+#!/usr/bin/env python\n+\"\"\"\n+build command test coverage\n+\"\"\"\n+\n+import unittest\n+import mock\n+\n+from cirrus.build import execute_build, build_parser\n+\n+\n+class BuildParserTests(unittest.TestCase):\n+    \"\"\"test build_parser\"\"\"\n+\n+    def test_build_parser(self):\n+        \"\"\"test parser setup\"\"\"\n+        argv = ['build']\n+        opts = build_parser(argv)\n+        self.assertEqual(opts.clean, False)\n+        self.assertEqual(opts.command, 'build')\n+        self.assertEqual(opts.docs, None)\n+        self.assertEqual(opts.extras, None)\n+        self.assertEqual(opts.nosetupdevelop, False)\n+        self.assertEqual(opts.upgrade, False)\n+\n+        argv = ['build', '--no-setup-develop']\n+        opts = build_parser(argv)\n+        self.failUnless(opts.nosetupdevelop)\n+\n+        argv = [\n+            'build',\n+            '--extra-requirements',\n+            'test-requirements.txt',\n+            ' other-requirements.txt'\n+        ]\n+        opts = build_parser(argv)\n+        self.assertEqual(\n+            opts.extras,\n+            ['test-requirements.txt', ' other-requirements.txt']\n+        )\n+\n+\n+class BuildCommandTests(unittest.TestCase):\n+    \"\"\"test coverage for build command code\"\"\"\n+    def setUp(self):\n+        \"\"\"set up patchers and mocks\"\"\"\n+        self.conf_patcher = mock.patch('cirrus.build.load_configuration')\n+        self.local_patcher = mock.patch('cirrus.build.local')\n+        self.os_path_exists_patcher = mock.patch('cirrus.build.os.path.exists')\n+        self.os_cwd_patcher = mock.patch('cirrus.build.os.getcwd')\n+        self.pypi_auth_patcher = mock.patch('cirrus.build.get_pypi_auth')\n+        self.cirrus_home_patcher = mock.patch('cirrus.build.cirrus_home')\n+\n+        self.build_params = {}\n+        self.pypi_url_value = None\n+\n+        self.mock_load_conf = self.conf_patcher.start()\n+        self.mock_conf = mock.Mock()\n+        self.mock_load_conf.return_value = self.mock_conf\n+        self.mock_conf.get = mock.Mock()\n+        self.mock_conf.get.return_value = self.build_params\n+        self.mock_conf.pypi_url = mock.Mock()\n+        self.mock_conf.pypi_url.return_value = self.pypi_url_value\n+        self.mock_local = self.local_patcher.start()\n+        self.mock_os_exists = self.os_path_exists_patcher.start()\n+        self.mock_os_exists.return_value = False\n+        self.mock_pypi_auth = self.pypi_auth_patcher.start()\n+        self.mock_os_cwd = self.os_cwd_patcher.start()\n+        self.mock_os_cwd.return_value = 'CWD'\n+        self.mock_cirrus_home = self.cirrus_home_patcher.start()\n+        self.mock_cirrus_home.return_value = 'CIRRUS_HOME'\n+\n+        self.mock_pypi_auth.return_value = {\n+            'username': 'PYPIUSERNAME',\n+            'ssh_username': 'SSHUSERNAME',\n+            'ssh_key': 'SSHKEY',\n+            'token': 'TOKEN'\n+        }\n+\n+    def tearDown(self):\n+        self.conf_patcher.stop()\n+        self.local_patcher.stop()\n+        self.os_path_exists_patcher.stop()\n+        self.pypi_auth_patcher.stop()\n+        self.os_cwd_patcher.stop()\n+        self.cirrus_home_patcher.stop()\n+\n+    def test_execute_build_default_pypi(self):\n+        \"\"\"test execute_build with default pypi settings\"\"\"\n+        opts = mock.Mock()\n+        opts.clean = False\n+        opts.upgrade = False\n+        opts.extras = []\n+        opts.nosetupdevelop = False\n+\n+        execute_build(opts)\n+\n+        self.mock_local.assert_has_calls([\n+            mock.call('CIRRUS_HOME/venv/bin/virtualenv CWD/venv'),\n+            mock.call('CWD/venv/bin/pip install -r requirements.txt'),\n+            mock.call('. ./venv/bin/activate && python setup.py develop')\n+        ])\n+\n+    def test_execute_build_default_pypi_upgrade(self):\n+        \"\"\"test execute_build with default pypi settings and upgrade\"\"\"\n+        opts = mock.Mock()\n+        opts.clean = False\n+        opts.upgrade = True\n+        opts.extras = []\n+        opts.nosetupdevelop = False\n+\n+        execute_build(opts)\n+\n+        self.mock_local.assert_has_calls([\n+            mock.call('CIRRUS_HOME/venv/bin/virtualenv CWD/venv'),\n+            mock.call('CWD/venv/bin/pip install --upgrade -r requirements.txt'),\n+            mock.call('. ./venv/bin/activate && python setup.py develop')\n+        ])\n+\n+    def test_execute_build_with_extras(self):\n+        \"\"\"test execute build with extra reqs\"\"\"\n+        opts = mock.Mock()\n+        opts.clean = False\n+        opts.upgrade = False\n+        opts.extras = ['test-requirements.txt']\n+        opts.nosetupdevelop = False\n+        execute_build(opts)\n+        self.mock_local.assert_has_calls([\n+            mock.call('CIRRUS_HOME/venv/bin/virtualenv CWD/venv'),\n+            mock.call('CWD/venv/bin/pip install -r requirements.txt'),\n+            mock.call('CWD/venv/bin/pip install -r test-requirements.txt'),\n+            mock.call('. ./venv/bin/activate && python setup.py develop')\n+        ])\n+\n+    def test_execute_build_with_nosetupdevelop(self):\n+        \"\"\"test nosetupdevelop option\"\"\"\n+        opts = mock.Mock()\n+        opts.clean = False\n+        opts.extras = []\n+        opts.upgrade = False\n+        opts.nosetupdevelop = True\n+\n+        execute_build(opts)\n+        self.mock_local.assert_has_calls([\n+            mock.call('CIRRUS_HOME/venv/bin/virtualenv CWD/venv'),\n+            mock.call('CWD/venv/bin/pip install -r requirements.txt')\n+        ])\n+\n+    def test_execute_build_with_pypi(self):\n+        \"\"\"test execute build with pypi opts\"\"\"\n+        opts = mock.Mock()\n+        opts.clean = False\n+        opts.extras = []\n+        opts.upgrade = False\n+        opts.nosetupdevelop = False\n+        self.mock_conf.pypi_url.return_value = \"PYPIURL\"\n+\n+        execute_build(opts)\n+\n+        self.mock_local.assert_has_calls([\n+            mock.call('CIRRUS_HOME/venv/bin/virtualenv CWD/venv'),\n+            mock.call('CWD/venv/bin/pip install -i https://PYPIUSERNAME:TOKEN@PYPIURL/simple -r requirements.txt'),\n+            mock.call('. ./venv/bin/activate && python setup.py develop')\n+\n+        ])\n+\n+    def test_execute_build_with_pypi_upgrade(self):\n+        \"\"\"test execute build with pypi opts and upgrade\"\"\"\n+        opts = mock.Mock()\n+        opts.clean = False\n+        opts.extras = []\n+        opts.nosetupdevelop = False\n+        opts.upgrade = True\n+        self.mock_conf.pypi_url.return_value = \"PYPIURL\"\n+\n+        execute_build(opts)\n+\n+        self.mock_local.assert_has_calls([\n+            mock.call('CIRRUS_HOME/venv/bin/virtualenv CWD/venv'),\n+            mock.call('CWD/venv/bin/pip install -i https://PYPIUSERNAME:TOKEN@PYPIURL/simple --upgrade -r requirements.txt'),\n+            mock.call('. ./venv/bin/activate && python setup.py develop')\n+\n+        ])\n+\n+","path":"tests/unit/cirrus/build_tests.py","position":185,"original_position":185,"commit_id":"1c7690912e53f559e43b937290091d7a195eb8cb","original_commit_id":"1c7690912e53f559e43b937290091d7a195eb8cb","user":{"login":"evansde77","id":342380,"avatar_url":"https://avatars.githubusercontent.com/u/342380?v=3","gravatar_id":"","url":"https://api.github.com/users/evansde77","html_url":"https://github.com/evansde77","followers_url":"https://api.github.com/users/evansde77/followers","following_url":"https://api.github.com/users/evansde77/following{/other_user}","gists_url":"https://api.github.com/users/evansde77/gists{/gist_id}","starred_url":"https://api.github.com/users/evansde77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evansde77/subscriptions","organizations_url":"https://api.github.com/users/evansde77/orgs","repos_url":"https://api.github.com/users/evansde77/repos","events_url":"https://api.github.com/users/evansde77/events{/privacy}","received_events_url":"https://api.github.com/users/evansde77/received_events","type":"User","site_admin":false},"body":"done","created_at":"2016-07-19T20:06:26Z","updated_at":"2016-07-19T20:06:26Z","html_url":"https://github.com/evansde77/cirrus/pull/124#discussion_r71413123","pull_request_url":"https://api.github.com/repos/evansde77/cirrus/pulls/124","_links":{"self":{"href":"https://api.github.com/repos/evansde77/cirrus/pulls/comments/71413123"},"html":{"href":"https://github.com/evansde77/cirrus/pull/124#discussion_r71413123"},"pull_request":{"href":"https://api.github.com/repos/evansde77/cirrus/pulls/124"}}},"pull_request":{"url":"https://api.github.com/repos/evansde77/cirrus/pulls/124","id":78019524,"html_url":"https://github.com/evansde77/cirrus/pull/124","diff_url":"https://github.com/evansde77/cirrus/pull/124.diff","patch_url":"https://github.com/evansde77/cirrus/pull/124.patch","issue_url":"https://api.github.com/repos/evansde77/cirrus/issues/124","number":124,"state":"open","locked":false,"title":"support multiple requirements, add no-setup-develop flag","user":{"login":"evansde77","id":342380,"avatar_url":"https://avatars.githubusercontent.com/u/342380?v=3","gravatar_id":"","url":"https://api.github.com/users/evansde77","html_url":"https://github.com/evansde77","followers_url":"https://api.github.com/users/evansde77/followers","following_url":"https://api.github.com/users/evansde77/following{/other_user}","gists_url":"https://api.github.com/users/evansde77/gists{/gist_id}","starred_url":"https://api.github.com/users/evansde77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evansde77/subscriptions","organizations_url":"https://api.github.com/users/evansde77/orgs","repos_url":"https://api.github.com/users/evansde77/repos","events_url":"https://api.github.com/users/evansde77/events{/privacy}","received_events_url":"https://api.github.com/users/evansde77/received_events","type":"User","site_admin":false},"body":"@jcounts @appeltel @shudgston @ksnavely \r\n\r\nAllow additional requirements files (eg test-requirements.txt) to be handled via git cirrus build command as in https://github.com/evansde77/cirrus/issues/123\r\n\r\nAdd --no-setup-develop option as requested in https://github.com/evansde77/cirrus/issues/44\r\n\r\nAdd test coverage for build command module","created_at":"2016-07-19T17:48:51Z","updated_at":"2016-07-19T20:06:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"43422f962cac6278b9c140dbe678c544070e5285","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/evansde77/cirrus/pulls/124/commits","review_comments_url":"https://api.github.com/repos/evansde77/cirrus/pulls/124/comments","review_comment_url":"https://api.github.com/repos/evansde77/cirrus/pulls/comments{/number}","comments_url":"https://api.github.com/repos/evansde77/cirrus/issues/124/comments","statuses_url":"https://api.github.com/repos/evansde77/cirrus/statuses/1c7690912e53f559e43b937290091d7a195eb8cb","head":{"label":"evansde77:feature/build-extra-reqs","ref":"feature/build-extra-reqs","sha":"1c7690912e53f559e43b937290091d7a195eb8cb","user":{"login":"evansde77","id":342380,"avatar_url":"https://avatars.githubusercontent.com/u/342380?v=3","gravatar_id":"","url":"https://api.github.com/users/evansde77","html_url":"https://github.com/evansde77","followers_url":"https://api.github.com/users/evansde77/followers","following_url":"https://api.github.com/users/evansde77/following{/other_user}","gists_url":"https://api.github.com/users/evansde77/gists{/gist_id}","starred_url":"https://api.github.com/users/evansde77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evansde77/subscriptions","organizations_url":"https://api.github.com/users/evansde77/orgs","repos_url":"https://api.github.com/users/evansde77/repos","events_url":"https://api.github.com/users/evansde77/events{/privacy}","received_events_url":"https://api.github.com/users/evansde77/received_events","type":"User","site_admin":false},"repo":{"id":17570751,"name":"cirrus","full_name":"evansde77/cirrus","owner":{"login":"evansde77","id":342380,"avatar_url":"https://avatars.githubusercontent.com/u/342380?v=3","gravatar_id":"","url":"https://api.github.com/users/evansde77","html_url":"https://github.com/evansde77","followers_url":"https://api.github.com/users/evansde77/followers","following_url":"https://api.github.com/users/evansde77/following{/other_user}","gists_url":"https://api.github.com/users/evansde77/gists{/gist_id}","starred_url":"https://api.github.com/users/evansde77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evansde77/subscriptions","organizations_url":"https://api.github.com/users/evansde77/orgs","repos_url":"https://api.github.com/users/evansde77/repos","events_url":"https://api.github.com/users/evansde77/events{/privacy}","received_events_url":"https://api.github.com/users/evansde77/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/evansde77/cirrus","description":"python library build, test and devop like things assistant","fork":false,"url":"https://api.github.com/repos/evansde77/cirrus","forks_url":"https://api.github.com/repos/evansde77/cirrus/forks","keys_url":"https://api.github.com/repos/evansde77/cirrus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/evansde77/cirrus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/evansde77/cirrus/teams","hooks_url":"https://api.github.com/repos/evansde77/cirrus/hooks","issue_events_url":"https://api.github.com/repos/evansde77/cirrus/issues/events{/number}","events_url":"https://api.github.com/repos/evansde77/cirrus/events","assignees_url":"https://api.github.com/repos/evansde77/cirrus/assignees{/user}","branches_url":"https://api.github.com/repos/evansde77/cirrus/branches{/branch}","tags_url":"https://api.github.com/repos/evansde77/cirrus/tags","blobs_url":"https://api.github.com/repos/evansde77/cirrus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/evansde77/cirrus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/evansde77/cirrus/git/refs{/sha}","trees_url":"https://api.github.com/repos/evansde77/cirrus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/evansde77/cirrus/statuses/{sha}","languages_url":"https://api.github.com/repos/evansde77/cirrus/languages","stargazers_url":"https://api.github.com/repos/evansde77/cirrus/stargazers","contributors_url":"https://api.github.com/repos/evansde77/cirrus/contributors","subscribers_url":"https://api.github.com/repos/evansde77/cirrus/subscribers","subscription_url":"https://api.github.com/repos/evansde77/cirrus/subscription","commits_url":"https://api.github.com/repos/evansde77/cirrus/commits{/sha}","git_commits_url":"https://api.github.com/repos/evansde77/cirrus/git/commits{/sha}","comments_url":"https://api.github.com/repos/evansde77/cirrus/comments{/number}","issue_comment_url":"https://api.github.com/repos/evansde77/cirrus/issues/comments{/number}","contents_url":"https://api.github.com/repos/evansde77/cirrus/contents/{+path}","compare_url":"https://api.github.com/repos/evansde77/cirrus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/evansde77/cirrus/merges","archive_url":"https://api.github.com/repos/evansde77/cirrus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/evansde77/cirrus/downloads","issues_url":"https://api.github.com/repos/evansde77/cirrus/issues{/number}","pulls_url":"https://api.github.com/repos/evansde77/cirrus/pulls{/number}","milestones_url":"https://api.github.com/repos/evansde77/cirrus/milestones{/number}","notifications_url":"https://api.github.com/repos/evansde77/cirrus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/evansde77/cirrus/labels{/name}","releases_url":"https://api.github.com/repos/evansde77/cirrus/releases{/id}","deployments_url":"https://api.github.com/repos/evansde77/cirrus/deployments","created_at":"2014-03-09T18:35:33Z","updated_at":"2016-05-03T12:35:28Z","pushed_at":"2016-07-19T17:48:52Z","git_url":"git://github.com/evansde77/cirrus.git","ssh_url":"git@github.com:evansde77/cirrus.git","clone_url":"https://github.com/evansde77/cirrus.git","svn_url":"https://github.com/evansde77/cirrus","homepage":null,"size":3367,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":14,"forks":0,"open_issues":14,"watchers":3,"default_branch":"develop"}},"base":{"label":"evansde77:develop","ref":"develop","sha":"451b1bd4099beadd20dc71910ec03a5bdc87a9fd","user":{"login":"evansde77","id":342380,"avatar_url":"https://avatars.githubusercontent.com/u/342380?v=3","gravatar_id":"","url":"https://api.github.com/users/evansde77","html_url":"https://github.com/evansde77","followers_url":"https://api.github.com/users/evansde77/followers","following_url":"https://api.github.com/users/evansde77/following{/other_user}","gists_url":"https://api.github.com/users/evansde77/gists{/gist_id}","starred_url":"https://api.github.com/users/evansde77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evansde77/subscriptions","organizations_url":"https://api.github.com/users/evansde77/orgs","repos_url":"https://api.github.com/users/evansde77/repos","events_url":"https://api.github.com/users/evansde77/events{/privacy}","received_events_url":"https://api.github.com/users/evansde77/received_events","type":"User","site_admin":false},"repo":{"id":17570751,"name":"cirrus","full_name":"evansde77/cirrus","owner":{"login":"evansde77","id":342380,"avatar_url":"https://avatars.githubusercontent.com/u/342380?v=3","gravatar_id":"","url":"https://api.github.com/users/evansde77","html_url":"https://github.com/evansde77","followers_url":"https://api.github.com/users/evansde77/followers","following_url":"https://api.github.com/users/evansde77/following{/other_user}","gists_url":"https://api.github.com/users/evansde77/gists{/gist_id}","starred_url":"https://api.github.com/users/evansde77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evansde77/subscriptions","organizations_url":"https://api.github.com/users/evansde77/orgs","repos_url":"https://api.github.com/users/evansde77/repos","events_url":"https://api.github.com/users/evansde77/events{/privacy}","received_events_url":"https://api.github.com/users/evansde77/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/evansde77/cirrus","description":"python library build, test and devop like things assistant","fork":false,"url":"https://api.github.com/repos/evansde77/cirrus","forks_url":"https://api.github.com/repos/evansde77/cirrus/forks","keys_url":"https://api.github.com/repos/evansde77/cirrus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/evansde77/cirrus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/evansde77/cirrus/teams","hooks_url":"https://api.github.com/repos/evansde77/cirrus/hooks","issue_events_url":"https://api.github.com/repos/evansde77/cirrus/issues/events{/number}","events_url":"https://api.github.com/repos/evansde77/cirrus/events","assignees_url":"https://api.github.com/repos/evansde77/cirrus/assignees{/user}","branches_url":"https://api.github.com/repos/evansde77/cirrus/branches{/branch}","tags_url":"https://api.github.com/repos/evansde77/cirrus/tags","blobs_url":"https://api.github.com/repos/evansde77/cirrus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/evansde77/cirrus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/evansde77/cirrus/git/refs{/sha}","trees_url":"https://api.github.com/repos/evansde77/cirrus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/evansde77/cirrus/statuses/{sha}","languages_url":"https://api.github.com/repos/evansde77/cirrus/languages","stargazers_url":"https://api.github.com/repos/evansde77/cirrus/stargazers","contributors_url":"https://api.github.com/repos/evansde77/cirrus/contributors","subscribers_url":"https://api.github.com/repos/evansde77/cirrus/subscribers","subscription_url":"https://api.github.com/repos/evansde77/cirrus/subscription","commits_url":"https://api.github.com/repos/evansde77/cirrus/commits{/sha}","git_commits_url":"https://api.github.com/repos/evansde77/cirrus/git/commits{/sha}","comments_url":"https://api.github.com/repos/evansde77/cirrus/comments{/number}","issue_comment_url":"https://api.github.com/repos/evansde77/cirrus/issues/comments{/number}","contents_url":"https://api.github.com/repos/evansde77/cirrus/contents/{+path}","compare_url":"https://api.github.com/repos/evansde77/cirrus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/evansde77/cirrus/merges","archive_url":"https://api.github.com/repos/evansde77/cirrus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/evansde77/cirrus/downloads","issues_url":"https://api.github.com/repos/evansde77/cirrus/issues{/number}","pulls_url":"https://api.github.com/repos/evansde77/cirrus/pulls{/number}","milestones_url":"https://api.github.com/repos/evansde77/cirrus/milestones{/number}","notifications_url":"https://api.github.com/repos/evansde77/cirrus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/evansde77/cirrus/labels{/name}","releases_url":"https://api.github.com/repos/evansde77/cirrus/releases{/id}","deployments_url":"https://api.github.com/repos/evansde77/cirrus/deployments","created_at":"2014-03-09T18:35:33Z","updated_at":"2016-05-03T12:35:28Z","pushed_at":"2016-07-19T17:48:52Z","git_url":"git://github.com/evansde77/cirrus.git","ssh_url":"git@github.com:evansde77/cirrus.git","clone_url":"https://github.com/evansde77/cirrus.git","svn_url":"https://github.com/evansde77/cirrus","homepage":null,"size":3367,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":14,"forks":0,"open_issues":14,"watchers":3,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/evansde77/cirrus/pulls/124"},"html":{"href":"https://github.com/evansde77/cirrus/pull/124"},"issue":{"href":"https://api.github.com/repos/evansde77/cirrus/issues/124"},"comments":{"href":"https://api.github.com/repos/evansde77/cirrus/issues/124/comments"},"review_comments":{"href":"https://api.github.com/repos/evansde77/cirrus/pulls/124/comments"},"review_comment":{"href":"https://api.github.com/repos/evansde77/cirrus/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/evansde77/cirrus/pulls/124/commits"},"statuses":{"href":"https://api.github.com/repos/evansde77/cirrus/statuses/1c7690912e53f559e43b937290091d7a195eb8cb"}}}}
{"actor":{"display_login":"evansde77"}}