{"action":"created","comment":{"url":"https://api.github.com/repos/CCI-MOC/haas/pulls/comments/32057520","id":32057520,"diff_hunk":"@@ -14,12 +14,80 @@\n \n from functools import wraps\n from haas.model import *\n-# XXX: This function has an underscore so that we don't import it elsewhere.\n-# But... we need it here.  Oops.\n-from haas.model import _on_virt_uri\n from haas.config import cfg\n-from haas import api\n+from haas import api, config\n import json\n+import subprocess\n+import os.path\n+\n+\n+def testsuite_config():\n+    \"\"\"A pytest decorator which loads an initial config from ``testsuite.cfg``.\n+\n+    Tests which don't care about a specific configuration should leave the\n+    config alone. This allows the developer to test with different\n+    configurations, e.g. different DBMS backends.\n+\n+    if testsuite.cfg doesn't exist, sane defaults are provided.\n+    \"\"\"\n+    # NOTE: The file ``testsuite.cfg.default`` Should be updated whenever\n+    # The default settings here are modified.\n+    if os.path.isfile('testsuite.cfg'):\n+        config.load('testsuite.cfg')\n+    else:\n+        config_set({\n+            'general': {\n+                'driver': 'null',\n+            },\n+            'devel': {\n+                'dry_run': True,\n+            },\n+            'headnode': {\n+                'base_imgs': 'base-headnode, img1, img2, img3, img4',\n+            },\n+            'database': {\n+                'uri': 'sqlite:///:memory:',\n+            },\n+        })\n+\n+\n+def config_merge(config_dict):\n+    \"\"\"Modify the configuration according to ``config_dict``.\n+\n+    ``config_dict`` should be a dictionary mapping section names (strings)\n+    to dictionaries mapping option names within a section (again, strings)\n+    to their values. If the value of a section, or option is None, that\n+    section or option is removed. Otherwise, the section is created if it\n+    does not exist, and any options are set to the specified values.\n+    \"\"\"\n+    for section in config_dict.keys():\n+        if config_dict[section] is None:\n+            cfg.remove_section(section)\n+        else:\n+            if not cfg.has_section(section):\n+                cfg.add_section(section)\n+            for option in config_dict[section].keys():\n+                if config_dict[section][option] is None:\n+                    config.remove_option(section, option)","path":"haas/test_common.py","position":62,"original_position":62,"commit_id":"e6de24124babdbf4c80979ec9d2fd3fc37bb8623","original_commit_id":"e6de24124babdbf4c80979ec9d2fd3fc37bb8623","user":{"login":"gsilvis","id":597557,"avatar_url":"https://avatars.githubusercontent.com/u/597557?v=3","gravatar_id":"","url":"https://api.github.com/users/gsilvis","html_url":"https://github.com/gsilvis","followers_url":"https://api.github.com/users/gsilvis/followers","following_url":"https://api.github.com/users/gsilvis/following{/other_user}","gists_url":"https://api.github.com/users/gsilvis/gists{/gist_id}","starred_url":"https://api.github.com/users/gsilvis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gsilvis/subscriptions","organizations_url":"https://api.github.com/users/gsilvis/orgs","repos_url":"https://api.github.com/users/gsilvis/repos","events_url":"https://api.github.com/users/gsilvis/events{/privacy}","received_events_url":"https://api.github.com/users/gsilvis/received_events","type":"User","site_admin":false},"body":"Same question as 6 lines above","created_at":"2015-06-09T20:08:33Z","updated_at":"2015-06-09T20:08:33Z","html_url":"https://github.com/CCI-MOC/haas/pull/437#discussion_r32057520","pull_request_url":"https://api.github.com/repos/CCI-MOC/haas/pulls/437","_links":{"self":{"href":"https://api.github.com/repos/CCI-MOC/haas/pulls/comments/32057520"},"html":{"href":"https://github.com/CCI-MOC/haas/pull/437#discussion_r32057520"},"pull_request":{"href":"https://api.github.com/repos/CCI-MOC/haas/pulls/437"}}},"pull_request":{"url":"https://api.github.com/repos/CCI-MOC/haas/pulls/437","id":37291566,"html_url":"https://github.com/CCI-MOC/haas/pull/437","diff_url":"https://github.com/CCI-MOC/haas/pull/437.diff","patch_url":"https://github.com/CCI-MOC/haas/pull/437.patch","issue_url":"https://api.github.com/repos/CCI-MOC/haas/issues/437","number":437,"state":"open","locked":false,"title":"Testsuite.cfg","user":{"login":"zenhack","id":883774,"avatar_url":"https://avatars.githubusercontent.com/u/883774?v=3","gravatar_id":"","url":"https://api.github.com/users/zenhack","html_url":"https://github.com/zenhack","followers_url":"https://api.github.com/users/zenhack/followers","following_url":"https://api.github.com/users/zenhack/following{/other_user}","gists_url":"https://api.github.com/users/zenhack/gists{/gist_id}","starred_url":"https://api.github.com/users/zenhack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zenhack/subscriptions","organizations_url":"https://api.github.com/users/zenhack/orgs","repos_url":"https://api.github.com/users/zenhack/repos","events_url":"https://api.github.com/users/zenhack/events{/privacy}","received_events_url":"https://api.github.com/users/zenhack/received_events","type":"User","site_admin":false},"body":"I haven't gotten a chance to run the deployment tests yet; would like to do that before we merge.\r\n\r\n@apoorvemohan, this will be useful for your postgres stuff.","created_at":"2015-06-09T19:46:27Z","updated_at":"2015-06-09T20:08:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ff1f9a511a683113adbf80210578b96bee33935b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/CCI-MOC/haas/pulls/437/commits","review_comments_url":"https://api.github.com/repos/CCI-MOC/haas/pulls/437/comments","review_comment_url":"https://api.github.com/repos/CCI-MOC/haas/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CCI-MOC/haas/issues/437/comments","statuses_url":"https://api.github.com/repos/CCI-MOC/haas/statuses/e6de24124babdbf4c80979ec9d2fd3fc37bb8623","head":{"label":"zenhack:testsuite.cfg","ref":"testsuite.cfg","sha":"e6de24124babdbf4c80979ec9d2fd3fc37bb8623","user":{"login":"zenhack","id":883774,"avatar_url":"https://avatars.githubusercontent.com/u/883774?v=3","gravatar_id":"","url":"https://api.github.com/users/zenhack","html_url":"https://github.com/zenhack","followers_url":"https://api.github.com/users/zenhack/followers","following_url":"https://api.github.com/users/zenhack/following{/other_user}","gists_url":"https://api.github.com/users/zenhack/gists{/gist_id}","starred_url":"https://api.github.com/users/zenhack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zenhack/subscriptions","organizations_url":"https://api.github.com/users/zenhack/orgs","repos_url":"https://api.github.com/users/zenhack/repos","events_url":"https://api.github.com/users/zenhack/events{/privacy}","received_events_url":"https://api.github.com/users/zenhack/received_events","type":"User","site_admin":false},"repo":{"id":19796467,"name":"haas","full_name":"zenhack/haas","owner":{"login":"zenhack","id":883774,"avatar_url":"https://avatars.githubusercontent.com/u/883774?v=3","gravatar_id":"","url":"https://api.github.com/users/zenhack","html_url":"https://github.com/zenhack","followers_url":"https://api.github.com/users/zenhack/followers","following_url":"https://api.github.com/users/zenhack/following{/other_user}","gists_url":"https://api.github.com/users/zenhack/gists{/gist_id}","starred_url":"https://api.github.com/users/zenhack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zenhack/subscriptions","organizations_url":"https://api.github.com/users/zenhack/orgs","repos_url":"https://api.github.com/users/zenhack/repos","events_url":"https://api.github.com/users/zenhack/events{/privacy}","received_events_url":"https://api.github.com/users/zenhack/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zenhack/haas","description":"","fork":true,"url":"https://api.github.com/repos/zenhack/haas","forks_url":"https://api.github.com/repos/zenhack/haas/forks","keys_url":"https://api.github.com/repos/zenhack/haas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zenhack/haas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zenhack/haas/teams","hooks_url":"https://api.github.com/repos/zenhack/haas/hooks","issue_events_url":"https://api.github.com/repos/zenhack/haas/issues/events{/number}","events_url":"https://api.github.com/repos/zenhack/haas/events","assignees_url":"https://api.github.com/repos/zenhack/haas/assignees{/user}","branches_url":"https://api.github.com/repos/zenhack/haas/branches{/branch}","tags_url":"https://api.github.com/repos/zenhack/haas/tags","blobs_url":"https://api.github.com/repos/zenhack/haas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zenhack/haas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zenhack/haas/git/refs{/sha}","trees_url":"https://api.github.com/repos/zenhack/haas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zenhack/haas/statuses/{sha}","languages_url":"https://api.github.com/repos/zenhack/haas/languages","stargazers_url":"https://api.github.com/repos/zenhack/haas/stargazers","contributors_url":"https://api.github.com/repos/zenhack/haas/contributors","subscribers_url":"https://api.github.com/repos/zenhack/haas/subscribers","subscription_url":"https://api.github.com/repos/zenhack/haas/subscription","commits_url":"https://api.github.com/repos/zenhack/haas/commits{/sha}","git_commits_url":"https://api.github.com/repos/zenhack/haas/git/commits{/sha}","comments_url":"https://api.github.com/repos/zenhack/haas/comments{/number}","issue_comment_url":"https://api.github.com/repos/zenhack/haas/issues/comments{/number}","contents_url":"https://api.github.com/repos/zenhack/haas/contents/{+path}","compare_url":"https://api.github.com/repos/zenhack/haas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zenhack/haas/merges","archive_url":"https://api.github.com/repos/zenhack/haas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zenhack/haas/downloads","issues_url":"https://api.github.com/repos/zenhack/haas/issues{/number}","pulls_url":"https://api.github.com/repos/zenhack/haas/pulls{/number}","milestones_url":"https://api.github.com/repos/zenhack/haas/milestones{/number}","notifications_url":"https://api.github.com/repos/zenhack/haas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zenhack/haas/labels{/name}","releases_url":"https://api.github.com/repos/zenhack/haas/releases{/id}","created_at":"2014-05-14T21:13:52Z","updated_at":"2014-06-27T05:22:27Z","pushed_at":"2015-06-09T19:45:12Z","git_url":"git://github.com/zenhack/haas.git","ssh_url":"git@github.com:zenhack/haas.git","clone_url":"https://github.com/zenhack/haas.git","svn_url":"https://github.com/zenhack/haas","homepage":null,"size":2511,"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":"devel"}},"base":{"label":"CCI-MOC:master","ref":"master","sha":"e0243cdfe2ea146a0a8977f894d80bcc313b65bf","user":{"login":"CCI-MOC","id":3578683,"avatar_url":"https://avatars.githubusercontent.com/u/3578683?v=3","gravatar_id":"","url":"https://api.github.com/users/CCI-MOC","html_url":"https://github.com/CCI-MOC","followers_url":"https://api.github.com/users/CCI-MOC/followers","following_url":"https://api.github.com/users/CCI-MOC/following{/other_user}","gists_url":"https://api.github.com/users/CCI-MOC/gists{/gist_id}","starred_url":"https://api.github.com/users/CCI-MOC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CCI-MOC/subscriptions","organizations_url":"https://api.github.com/users/CCI-MOC/orgs","repos_url":"https://api.github.com/users/CCI-MOC/repos","events_url":"https://api.github.com/users/CCI-MOC/events{/privacy}","received_events_url":"https://api.github.com/users/CCI-MOC/received_events","type":"Organization","site_admin":false},"repo":{"id":16487339,"name":"haas","full_name":"CCI-MOC/haas","owner":{"login":"CCI-MOC","id":3578683,"avatar_url":"https://avatars.githubusercontent.com/u/3578683?v=3","gravatar_id":"","url":"https://api.github.com/users/CCI-MOC","html_url":"https://github.com/CCI-MOC","followers_url":"https://api.github.com/users/CCI-MOC/followers","following_url":"https://api.github.com/users/CCI-MOC/following{/other_user}","gists_url":"https://api.github.com/users/CCI-MOC/gists{/gist_id}","starred_url":"https://api.github.com/users/CCI-MOC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CCI-MOC/subscriptions","organizations_url":"https://api.github.com/users/CCI-MOC/orgs","repos_url":"https://api.github.com/users/CCI-MOC/repos","events_url":"https://api.github.com/users/CCI-MOC/events{/privacy}","received_events_url":"https://api.github.com/users/CCI-MOC/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CCI-MOC/haas","description":"","fork":false,"url":"https://api.github.com/repos/CCI-MOC/haas","forks_url":"https://api.github.com/repos/CCI-MOC/haas/forks","keys_url":"https://api.github.com/repos/CCI-MOC/haas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CCI-MOC/haas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CCI-MOC/haas/teams","hooks_url":"https://api.github.com/repos/CCI-MOC/haas/hooks","issue_events_url":"https://api.github.com/repos/CCI-MOC/haas/issues/events{/number}","events_url":"https://api.github.com/repos/CCI-MOC/haas/events","assignees_url":"https://api.github.com/repos/CCI-MOC/haas/assignees{/user}","branches_url":"https://api.github.com/repos/CCI-MOC/haas/branches{/branch}","tags_url":"https://api.github.com/repos/CCI-MOC/haas/tags","blobs_url":"https://api.github.com/repos/CCI-MOC/haas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CCI-MOC/haas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CCI-MOC/haas/git/refs{/sha}","trees_url":"https://api.github.com/repos/CCI-MOC/haas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CCI-MOC/haas/statuses/{sha}","languages_url":"https://api.github.com/repos/CCI-MOC/haas/languages","stargazers_url":"https://api.github.com/repos/CCI-MOC/haas/stargazers","contributors_url":"https://api.github.com/repos/CCI-MOC/haas/contributors","subscribers_url":"https://api.github.com/repos/CCI-MOC/haas/subscribers","subscription_url":"https://api.github.com/repos/CCI-MOC/haas/subscription","commits_url":"https://api.github.com/repos/CCI-MOC/haas/commits{/sha}","git_commits_url":"https://api.github.com/repos/CCI-MOC/haas/git/commits{/sha}","comments_url":"https://api.github.com/repos/CCI-MOC/haas/comments{/number}","issue_comment_url":"https://api.github.com/repos/CCI-MOC/haas/issues/comments{/number}","contents_url":"https://api.github.com/repos/CCI-MOC/haas/contents/{+path}","compare_url":"https://api.github.com/repos/CCI-MOC/haas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CCI-MOC/haas/merges","archive_url":"https://api.github.com/repos/CCI-MOC/haas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CCI-MOC/haas/downloads","issues_url":"https://api.github.com/repos/CCI-MOC/haas/issues{/number}","pulls_url":"https://api.github.com/repos/CCI-MOC/haas/pulls{/number}","milestones_url":"https://api.github.com/repos/CCI-MOC/haas/milestones{/number}","notifications_url":"https://api.github.com/repos/CCI-MOC/haas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CCI-MOC/haas/labels{/name}","releases_url":"https://api.github.com/repos/CCI-MOC/haas/releases{/id}","created_at":"2014-02-03T17:48:01Z","updated_at":"2015-05-14T22:15:54Z","pushed_at":"2015-06-09T19:46:28Z","git_url":"git://github.com/CCI-MOC/haas.git","ssh_url":"git@github.com:CCI-MOC/haas.git","clone_url":"https://github.com/CCI-MOC/haas.git","svn_url":"https://github.com/CCI-MOC/haas","homepage":null,"size":5572,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":90,"forks":20,"open_issues":90,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CCI-MOC/haas/pulls/437"},"html":{"href":"https://github.com/CCI-MOC/haas/pull/437"},"issue":{"href":"https://api.github.com/repos/CCI-MOC/haas/issues/437"},"comments":{"href":"https://api.github.com/repos/CCI-MOC/haas/issues/437/comments"},"review_comments":{"href":"https://api.github.com/repos/CCI-MOC/haas/pulls/437/comments"},"review_comment":{"href":"https://api.github.com/repos/CCI-MOC/haas/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CCI-MOC/haas/pulls/437/commits"},"statuses":{"href":"https://api.github.com/repos/CCI-MOC/haas/statuses/e6de24124babdbf4c80979ec9d2fd3fc37bb8623"}}}}