{"action":"created","comment":{"url":"https://api.github.com/repos/dmwm/WMCore/pulls/comments/40343560","id":40343560,"diff_hunk":"@@ -0,0 +1,48 @@\n+#!/usr/bin/env python\n+#-*- coding: utf-8 -*-\n+#pylint: disable=\n+\"\"\"\n+File       : DBTest.py\n+Author     : Valentin Kuznetsov <vkuznet AT gmail dot com>\n+Description: Base class for WMCore database related unit tests.\n+             It defines test database name based on user preferences specified via\n+             environment variables and setup logic to setup/tear down actions\n+             based on database.\n+\"\"\"\n+from __future__ import print_function\n+\n+# system modules\n+import os\n+import sys\n+import unittest\n+\n+class DBTest(unittest.TestCase):\n+    def __init__(self, methodName='runTest'):\n+        super(WMCoreUnitTest, self).__init__(methodName)\n+        self.dbName = os.environ.get('WMCORE_TEST_DATABASE', \\\n+                'unittest_%s' % self.__class__.__name__)\n+        print(\"WMCoreTestDB test %s database\" % self.dbName)\n+        enforce = os.environ.get('WMCORE_TEST_DATABASE_DELETE', False)\n+        if  enforce:","path":"src/python/WMCore/Database/DBTest.py","position":26,"original_position":26,"commit_id":"949550dba899388ad7147d05737f23e2f39759c3","original_commit_id":"949550dba899388ad7147d05737f23e2f39759c3","user":{"login":"vkuznet","id":125138,"avatar_url":"https://avatars.githubusercontent.com/u/125138?v=3","gravatar_id":"","url":"https://api.github.com/users/vkuznet","html_url":"https://github.com/vkuznet","followers_url":"https://api.github.com/users/vkuznet/followers","following_url":"https://api.github.com/users/vkuznet/following{/other_user}","gists_url":"https://api.github.com/users/vkuznet/gists{/gist_id}","starred_url":"https://api.github.com/users/vkuznet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkuznet/subscriptions","organizations_url":"https://api.github.com/users/vkuznet/orgs","repos_url":"https://api.github.com/users/vkuznet/repos","events_url":"https://api.github.com/users/vkuznet/events{/privacy}","received_events_url":"https://api.github.com/users/vkuznet/received_events","type":"User","site_admin":false},"body":"Yes, dbName would be either what user provides or unittest_bla.\nUser can provide additional environment to enforce deletion of database.\n\nOn  0, Eric Vaandering <notifications@github.com> wrote:\n> > +\"\"\"\n> > +from __future__ import print_function\n> > +\n> > +# system modules\n> > +import os\n> > +import sys\n> > +import unittest\n> > +\n> > +class DBTest(unittest.TestCase):\n> > +    def __init__(self, methodName='runTest'):\n> > +        super(WMCoreUnitTest, self).__init__(methodName)\n> > +        self.dbName = os.environ.get('WMCORE_TEST_DATABASE', \\\n> > +                'unittest_%s' % self.__class__.__name__)\n> > +        print(\"WMCoreTestDB test %s database\" % self.dbName)\n> > +        enforce = os.environ.get('WMCORE_TEST_DATABASE_DELETE', False)\n> > +        if  enforce:\n> \n> Ok, so I think I understand this point now. This is used to crop and recreate the database once per task iff person running it is setting the database name themselves (line 22) and has this flag set.\n> \n> ---\n> Reply to this email directly or view it on GitHub:\n> https://github.com/dmwm/WMCore/pull/6283/files#r40341166\n","created_at":"2015-09-24T16:59:30Z","updated_at":"2015-09-24T16:59:30Z","html_url":"https://github.com/dmwm/WMCore/pull/6283#discussion_r40343560","pull_request_url":"https://api.github.com/repos/dmwm/WMCore/pulls/6283","_links":{"self":{"href":"https://api.github.com/repos/dmwm/WMCore/pulls/comments/40343560"},"html":{"href":"https://github.com/dmwm/WMCore/pull/6283#discussion_r40343560"},"pull_request":{"href":"https://api.github.com/repos/dmwm/WMCore/pulls/6283"}}},"pull_request":{"url":"https://api.github.com/repos/dmwm/WMCore/pulls/6283","id":45916491,"html_url":"https://github.com/dmwm/WMCore/pull/6283","diff_url":"https://github.com/dmwm/WMCore/pull/6283.diff","patch_url":"https://github.com/dmwm/WMCore/pull/6283.patch","issue_url":"https://api.github.com/repos/dmwm/WMCore/issues/6283","number":6283,"state":"open","locked":false,"title":"New base class to deal with database(s) in unit tests","user":{"login":"vkuznet","id":125138,"avatar_url":"https://avatars.githubusercontent.com/u/125138?v=3","gravatar_id":"","url":"https://api.github.com/users/vkuznet","html_url":"https://github.com/vkuznet","followers_url":"https://api.github.com/users/vkuznet/followers","following_url":"https://api.github.com/users/vkuznet/following{/other_user}","gists_url":"https://api.github.com/users/vkuznet/gists{/gist_id}","starred_url":"https://api.github.com/users/vkuznet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkuznet/subscriptions","organizations_url":"https://api.github.com/users/vkuznet/orgs","repos_url":"https://api.github.com/users/vkuznet/repos","events_url":"https://api.github.com/users/vkuznet/events{/privacy}","received_events_url":"https://api.github.com/users/vkuznet/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-24T16:06:58Z","updated_at":"2015-09-24T16:59:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"df5ac043b74c150a0e9310ff65eda03e9005a38d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dmwm/WMCore/pulls/6283/commits","review_comments_url":"https://api.github.com/repos/dmwm/WMCore/pulls/6283/comments","review_comment_url":"https://api.github.com/repos/dmwm/WMCore/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dmwm/WMCore/issues/6283/comments","statuses_url":"https://api.github.com/repos/dmwm/WMCore/statuses/949550dba899388ad7147d05737f23e2f39759c3","head":{"label":"vkuznet:WMCoreUnitTest_base","ref":"WMCoreUnitTest_base","sha":"949550dba899388ad7147d05737f23e2f39759c3","user":{"login":"vkuznet","id":125138,"avatar_url":"https://avatars.githubusercontent.com/u/125138?v=3","gravatar_id":"","url":"https://api.github.com/users/vkuznet","html_url":"https://github.com/vkuznet","followers_url":"https://api.github.com/users/vkuznet/followers","following_url":"https://api.github.com/users/vkuznet/following{/other_user}","gists_url":"https://api.github.com/users/vkuznet/gists{/gist_id}","starred_url":"https://api.github.com/users/vkuznet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkuznet/subscriptions","organizations_url":"https://api.github.com/users/vkuznet/orgs","repos_url":"https://api.github.com/users/vkuznet/repos","events_url":"https://api.github.com/users/vkuznet/events{/privacy}","received_events_url":"https://api.github.com/users/vkuznet/received_events","type":"User","site_admin":false},"repo":{"id":19494576,"name":"WMCore","full_name":"vkuznet/WMCore","owner":{"login":"vkuznet","id":125138,"avatar_url":"https://avatars.githubusercontent.com/u/125138?v=3","gravatar_id":"","url":"https://api.github.com/users/vkuznet","html_url":"https://github.com/vkuznet","followers_url":"https://api.github.com/users/vkuznet/followers","following_url":"https://api.github.com/users/vkuznet/following{/other_user}","gists_url":"https://api.github.com/users/vkuznet/gists{/gist_id}","starred_url":"https://api.github.com/users/vkuznet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkuznet/subscriptions","organizations_url":"https://api.github.com/users/vkuznet/orgs","repos_url":"https://api.github.com/users/vkuznet/repos","events_url":"https://api.github.com/users/vkuznet/events{/privacy}","received_events_url":"https://api.github.com/users/vkuznet/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vkuznet/WMCore","description":"WMCore","fork":true,"url":"https://api.github.com/repos/vkuznet/WMCore","forks_url":"https://api.github.com/repos/vkuznet/WMCore/forks","keys_url":"https://api.github.com/repos/vkuznet/WMCore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vkuznet/WMCore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vkuznet/WMCore/teams","hooks_url":"https://api.github.com/repos/vkuznet/WMCore/hooks","issue_events_url":"https://api.github.com/repos/vkuznet/WMCore/issues/events{/number}","events_url":"https://api.github.com/repos/vkuznet/WMCore/events","assignees_url":"https://api.github.com/repos/vkuznet/WMCore/assignees{/user}","branches_url":"https://api.github.com/repos/vkuznet/WMCore/branches{/branch}","tags_url":"https://api.github.com/repos/vkuznet/WMCore/tags","blobs_url":"https://api.github.com/repos/vkuznet/WMCore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vkuznet/WMCore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vkuznet/WMCore/git/refs{/sha}","trees_url":"https://api.github.com/repos/vkuznet/WMCore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vkuznet/WMCore/statuses/{sha}","languages_url":"https://api.github.com/repos/vkuznet/WMCore/languages","stargazers_url":"https://api.github.com/repos/vkuznet/WMCore/stargazers","contributors_url":"https://api.github.com/repos/vkuznet/WMCore/contributors","subscribers_url":"https://api.github.com/repos/vkuznet/WMCore/subscribers","subscription_url":"https://api.github.com/repos/vkuznet/WMCore/subscription","commits_url":"https://api.github.com/repos/vkuznet/WMCore/commits{/sha}","git_commits_url":"https://api.github.com/repos/vkuznet/WMCore/git/commits{/sha}","comments_url":"https://api.github.com/repos/vkuznet/WMCore/comments{/number}","issue_comment_url":"https://api.github.com/repos/vkuznet/WMCore/issues/comments{/number}","contents_url":"https://api.github.com/repos/vkuznet/WMCore/contents/{+path}","compare_url":"https://api.github.com/repos/vkuznet/WMCore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vkuznet/WMCore/merges","archive_url":"https://api.github.com/repos/vkuznet/WMCore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vkuznet/WMCore/downloads","issues_url":"https://api.github.com/repos/vkuznet/WMCore/issues{/number}","pulls_url":"https://api.github.com/repos/vkuznet/WMCore/pulls{/number}","milestones_url":"https://api.github.com/repos/vkuznet/WMCore/milestones{/number}","notifications_url":"https://api.github.com/repos/vkuznet/WMCore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vkuznet/WMCore/labels{/name}","releases_url":"https://api.github.com/repos/vkuznet/WMCore/releases{/id}","created_at":"2014-05-06T13:08:55Z","updated_at":"2015-05-08T14:47:14Z","pushed_at":"2015-09-24T16:44:12Z","git_url":"git://github.com/vkuznet/WMCore.git","ssh_url":"git@github.com:vkuznet/WMCore.git","clone_url":"https://github.com/vkuznet/WMCore.git","svn_url":"https://github.com/vkuznet/WMCore","homepage":"https://svnweb.cern.ch/trac/CMSDMWM/","size":24664,"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":"master"}},"base":{"label":"dmwm:master","ref":"master","sha":"7ec4692412b29cf0e58a5c8725c54e793b55780f","user":{"login":"dmwm","id":988897,"avatar_url":"https://avatars.githubusercontent.com/u/988897?v=3","gravatar_id":"","url":"https://api.github.com/users/dmwm","html_url":"https://github.com/dmwm","followers_url":"https://api.github.com/users/dmwm/followers","following_url":"https://api.github.com/users/dmwm/following{/other_user}","gists_url":"https://api.github.com/users/dmwm/gists{/gist_id}","starred_url":"https://api.github.com/users/dmwm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmwm/subscriptions","organizations_url":"https://api.github.com/users/dmwm/orgs","repos_url":"https://api.github.com/users/dmwm/repos","events_url":"https://api.github.com/users/dmwm/events{/privacy}","received_events_url":"https://api.github.com/users/dmwm/received_events","type":"Organization","site_admin":false},"repo":{"id":2370458,"name":"WMCore","full_name":"dmwm/WMCore","owner":{"login":"dmwm","id":988897,"avatar_url":"https://avatars.githubusercontent.com/u/988897?v=3","gravatar_id":"","url":"https://api.github.com/users/dmwm","html_url":"https://github.com/dmwm","followers_url":"https://api.github.com/users/dmwm/followers","following_url":"https://api.github.com/users/dmwm/following{/other_user}","gists_url":"https://api.github.com/users/dmwm/gists{/gist_id}","starred_url":"https://api.github.com/users/dmwm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmwm/subscriptions","organizations_url":"https://api.github.com/users/dmwm/orgs","repos_url":"https://api.github.com/users/dmwm/repos","events_url":"https://api.github.com/users/dmwm/events{/privacy}","received_events_url":"https://api.github.com/users/dmwm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dmwm/WMCore","description":"WMCore","fork":false,"url":"https://api.github.com/repos/dmwm/WMCore","forks_url":"https://api.github.com/repos/dmwm/WMCore/forks","keys_url":"https://api.github.com/repos/dmwm/WMCore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dmwm/WMCore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dmwm/WMCore/teams","hooks_url":"https://api.github.com/repos/dmwm/WMCore/hooks","issue_events_url":"https://api.github.com/repos/dmwm/WMCore/issues/events{/number}","events_url":"https://api.github.com/repos/dmwm/WMCore/events","assignees_url":"https://api.github.com/repos/dmwm/WMCore/assignees{/user}","branches_url":"https://api.github.com/repos/dmwm/WMCore/branches{/branch}","tags_url":"https://api.github.com/repos/dmwm/WMCore/tags","blobs_url":"https://api.github.com/repos/dmwm/WMCore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dmwm/WMCore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dmwm/WMCore/git/refs{/sha}","trees_url":"https://api.github.com/repos/dmwm/WMCore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dmwm/WMCore/statuses/{sha}","languages_url":"https://api.github.com/repos/dmwm/WMCore/languages","stargazers_url":"https://api.github.com/repos/dmwm/WMCore/stargazers","contributors_url":"https://api.github.com/repos/dmwm/WMCore/contributors","subscribers_url":"https://api.github.com/repos/dmwm/WMCore/subscribers","subscription_url":"https://api.github.com/repos/dmwm/WMCore/subscription","commits_url":"https://api.github.com/repos/dmwm/WMCore/commits{/sha}","git_commits_url":"https://api.github.com/repos/dmwm/WMCore/git/commits{/sha}","comments_url":"https://api.github.com/repos/dmwm/WMCore/comments{/number}","issue_comment_url":"https://api.github.com/repos/dmwm/WMCore/issues/comments{/number}","contents_url":"https://api.github.com/repos/dmwm/WMCore/contents/{+path}","compare_url":"https://api.github.com/repos/dmwm/WMCore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dmwm/WMCore/merges","archive_url":"https://api.github.com/repos/dmwm/WMCore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dmwm/WMCore/downloads","issues_url":"https://api.github.com/repos/dmwm/WMCore/issues{/number}","pulls_url":"https://api.github.com/repos/dmwm/WMCore/pulls{/number}","milestones_url":"https://api.github.com/repos/dmwm/WMCore/milestones{/number}","notifications_url":"https://api.github.com/repos/dmwm/WMCore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dmwm/WMCore/labels{/name}","releases_url":"https://api.github.com/repos/dmwm/WMCore/releases{/id}","created_at":"2011-09-12T10:37:21Z","updated_at":"2015-05-08T18:42:10Z","pushed_at":"2015-09-24T16:06:58Z","git_url":"git://github.com/dmwm/WMCore.git","ssh_url":"git@github.com:dmwm/WMCore.git","clone_url":"https://github.com/dmwm/WMCore.git","svn_url":"https://github.com/dmwm/WMCore","homepage":"https://svnweb.cern.ch/trac/CMSDMWM/","size":64237,"stargazers_count":24,"watchers_count":24,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":48,"mirror_url":null,"open_issues_count":320,"forks":48,"open_issues":320,"watchers":24,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dmwm/WMCore/pulls/6283"},"html":{"href":"https://github.com/dmwm/WMCore/pull/6283"},"issue":{"href":"https://api.github.com/repos/dmwm/WMCore/issues/6283"},"comments":{"href":"https://api.github.com/repos/dmwm/WMCore/issues/6283/comments"},"review_comments":{"href":"https://api.github.com/repos/dmwm/WMCore/pulls/6283/comments"},"review_comment":{"href":"https://api.github.com/repos/dmwm/WMCore/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dmwm/WMCore/pulls/6283/commits"},"statuses":{"href":"https://api.github.com/repos/dmwm/WMCore/statuses/949550dba899388ad7147d05737f23e2f39759c3"}}}}