{"action":"created","comment":{"url":"https://api.github.com/repos/enthought/traits/pulls/comments/48744071","id":48744071,"diff_hunk":"@@ -8,7 +8,10 @@\n import sys\n import tempfile\n import time\n-import unittest\n+if sys.version_info[:2] == (2, 6):\n+    import unittest2 as unittest\n+else:\n+    import unittest","path":"traits/etsconfig/tests/test_etsconfig.py","position":8,"original_position":8,"commit_id":"facc1fca046504bb23a58e7585a93ea0e68223ec","original_commit_id":"facc1fca046504bb23a58e7585a93ea0e68223ec","user":{"login":"pberkes","id":314633,"avatar_url":"https://avatars.githubusercontent.com/u/314633?v=3","gravatar_id":"","url":"https://api.github.com/users/pberkes","html_url":"https://github.com/pberkes","followers_url":"https://api.github.com/users/pberkes/followers","following_url":"https://api.github.com/users/pberkes/following{/other_user}","gists_url":"https://api.github.com/users/pberkes/gists{/gist_id}","starred_url":"https://api.github.com/users/pberkes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pberkes/subscriptions","organizations_url":"https://api.github.com/users/pberkes/orgs","repos_url":"https://api.github.com/users/pberkes/repos","events_url":"https://api.github.com/users/pberkes/events{/privacy}","received_events_url":"https://api.github.com/users/pberkes/received_events","type":"User","site_admin":false},"body":"Elsewhere in the library we use `from traits.testing.unittest_tools import unittest`, which does the same but without repetitions","created_at":"2016-01-04T15:53:04Z","updated_at":"2016-01-04T15:53:04Z","html_url":"https://github.com/enthought/traits/pull/276#discussion_r48744071","pull_request_url":"https://api.github.com/repos/enthought/traits/pulls/276","_links":{"self":{"href":"https://api.github.com/repos/enthought/traits/pulls/comments/48744071"},"html":{"href":"https://github.com/enthought/traits/pull/276#discussion_r48744071"},"pull_request":{"href":"https://api.github.com/repos/enthought/traits/pulls/276"}}},"pull_request":{"url":"https://api.github.com/repos/enthought/traits/pulls/276","id":54984025,"html_url":"https://github.com/enthought/traits/pull/276","diff_url":"https://github.com/enthought/traits/pull/276.diff","patch_url":"https://github.com/enthought/traits/pull/276.patch","issue_url":"https://api.github.com/repos/enthought/traits/issues/276","number":276,"state":"open","locked":false,"title":"Context manager that provisionally sets the ETSConfig toolkit","user":{"login":"corranwebster","id":600761,"avatar_url":"https://avatars.githubusercontent.com/u/600761?v=3","gravatar_id":"","url":"https://api.github.com/users/corranwebster","html_url":"https://github.com/corranwebster","followers_url":"https://api.github.com/users/corranwebster/followers","following_url":"https://api.github.com/users/corranwebster/following{/other_user}","gists_url":"https://api.github.com/users/corranwebster/gists{/gist_id}","starred_url":"https://api.github.com/users/corranwebster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corranwebster/subscriptions","organizations_url":"https://api.github.com/users/corranwebster/orgs","repos_url":"https://api.github.com/users/corranwebster/repos","events_url":"https://api.github.com/users/corranwebster/events{/privacy}","received_events_url":"https://api.github.com/users/corranwebster/received_events","type":"User","site_admin":false},"body":"With the change in the default ETSConfig toolkit in TraitsUI a pre-existing bug was uncovered where, if the toolkit isn't expressly set, you can:\r\n\r\n* attempt to import a preferred toolkit implementation in one library (eg. wx backend for enable)\r\n* have it incidentally (and sometimes sub-optimally, but that's a separate issue) import another library with a different backend preference (eg. qt backend for pyface)\r\n* things go badly from there\r\n\r\nThis PR adds a new context manager method to the ETSConfig object that allows a library to provisionally choose a backend that other libraries will respect, but then undo that selection if a problem occurs in the context manager's block.  The intent is to wrap the import methods in the various toolkit selection methods with this context manager.\r\n\r\nThis is not a perfect fix, but will help somewhat with this particular pain point.\r\n","created_at":"2016-01-04T15:09:42Z","updated_at":"2016-01-04T15:53:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"38f27d3e931acd21863d06653409f31cb743350d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/enthought/traits/pulls/276/commits","review_comments_url":"https://api.github.com/repos/enthought/traits/pulls/276/comments","review_comment_url":"https://api.github.com/repos/enthought/traits/pulls/comments{/number}","comments_url":"https://api.github.com/repos/enthought/traits/issues/276/comments","statuses_url":"https://api.github.com/repos/enthought/traits/statuses/facc1fca046504bb23a58e7585a93ea0e68223ec","head":{"label":"enthought:feature/etsconfig-provisional-toolkit","ref":"feature/etsconfig-provisional-toolkit","sha":"facc1fca046504bb23a58e7585a93ea0e68223ec","user":{"login":"enthought","id":539651,"avatar_url":"https://avatars.githubusercontent.com/u/539651?v=3","gravatar_id":"","url":"https://api.github.com/users/enthought","html_url":"https://github.com/enthought","followers_url":"https://api.github.com/users/enthought/followers","following_url":"https://api.github.com/users/enthought/following{/other_user}","gists_url":"https://api.github.com/users/enthought/gists{/gist_id}","starred_url":"https://api.github.com/users/enthought/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enthought/subscriptions","organizations_url":"https://api.github.com/users/enthought/orgs","repos_url":"https://api.github.com/users/enthought/repos","events_url":"https://api.github.com/users/enthought/events{/privacy}","received_events_url":"https://api.github.com/users/enthought/received_events","type":"Organization","site_admin":false},"repo":{"id":1301745,"name":"traits","full_name":"enthought/traits","owner":{"login":"enthought","id":539651,"avatar_url":"https://avatars.githubusercontent.com/u/539651?v=3","gravatar_id":"","url":"https://api.github.com/users/enthought","html_url":"https://github.com/enthought","followers_url":"https://api.github.com/users/enthought/followers","following_url":"https://api.github.com/users/enthought/following{/other_user}","gists_url":"https://api.github.com/users/enthought/gists{/gist_id}","starred_url":"https://api.github.com/users/enthought/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enthought/subscriptions","organizations_url":"https://api.github.com/users/enthought/orgs","repos_url":"https://api.github.com/users/enthought/repos","events_url":"https://api.github.com/users/enthought/events{/privacy}","received_events_url":"https://api.github.com/users/enthought/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/enthought/traits","description":"Optional type-checking, data dependencies, and event notifications for Python","fork":false,"url":"https://api.github.com/repos/enthought/traits","forks_url":"https://api.github.com/repos/enthought/traits/forks","keys_url":"https://api.github.com/repos/enthought/traits/keys{/key_id}","collaborators_url":"https://api.github.com/repos/enthought/traits/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/enthought/traits/teams","hooks_url":"https://api.github.com/repos/enthought/traits/hooks","issue_events_url":"https://api.github.com/repos/enthought/traits/issues/events{/number}","events_url":"https://api.github.com/repos/enthought/traits/events","assignees_url":"https://api.github.com/repos/enthought/traits/assignees{/user}","branches_url":"https://api.github.com/repos/enthought/traits/branches{/branch}","tags_url":"https://api.github.com/repos/enthought/traits/tags","blobs_url":"https://api.github.com/repos/enthought/traits/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/enthought/traits/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/enthought/traits/git/refs{/sha}","trees_url":"https://api.github.com/repos/enthought/traits/git/trees{/sha}","statuses_url":"https://api.github.com/repos/enthought/traits/statuses/{sha}","languages_url":"https://api.github.com/repos/enthought/traits/languages","stargazers_url":"https://api.github.com/repos/enthought/traits/stargazers","contributors_url":"https://api.github.com/repos/enthought/traits/contributors","subscribers_url":"https://api.github.com/repos/enthought/traits/subscribers","subscription_url":"https://api.github.com/repos/enthought/traits/subscription","commits_url":"https://api.github.com/repos/enthought/traits/commits{/sha}","git_commits_url":"https://api.github.com/repos/enthought/traits/git/commits{/sha}","comments_url":"https://api.github.com/repos/enthought/traits/comments{/number}","issue_comment_url":"https://api.github.com/repos/enthought/traits/issues/comments{/number}","contents_url":"https://api.github.com/repos/enthought/traits/contents/{+path}","compare_url":"https://api.github.com/repos/enthought/traits/compare/{base}...{head}","merges_url":"https://api.github.com/repos/enthought/traits/merges","archive_url":"https://api.github.com/repos/enthought/traits/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/enthought/traits/downloads","issues_url":"https://api.github.com/repos/enthought/traits/issues{/number}","pulls_url":"https://api.github.com/repos/enthought/traits/pulls{/number}","milestones_url":"https://api.github.com/repos/enthought/traits/milestones{/number}","notifications_url":"https://api.github.com/repos/enthought/traits/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/enthought/traits/labels{/name}","releases_url":"https://api.github.com/repos/enthought/traits/releases{/id}","created_at":"2011-01-28T04:46:40Z","updated_at":"2015-12-05T00:13:48Z","pushed_at":"2016-01-04T15:13:44Z","git_url":"git://github.com/enthought/traits.git","ssh_url":"git@github.com:enthought/traits.git","clone_url":"https://github.com/enthought/traits.git","svn_url":"https://github.com/enthought/traits","homepage":"","size":41996,"stargazers_count":125,"watchers_count":125,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":42,"mirror_url":null,"open_issues_count":75,"forks":42,"open_issues":75,"watchers":125,"default_branch":"master"}},"base":{"label":"enthought:master","ref":"master","sha":"ac5d0296def6a389f932add5fbcab2eef6e7334e","user":{"login":"enthought","id":539651,"avatar_url":"https://avatars.githubusercontent.com/u/539651?v=3","gravatar_id":"","url":"https://api.github.com/users/enthought","html_url":"https://github.com/enthought","followers_url":"https://api.github.com/users/enthought/followers","following_url":"https://api.github.com/users/enthought/following{/other_user}","gists_url":"https://api.github.com/users/enthought/gists{/gist_id}","starred_url":"https://api.github.com/users/enthought/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enthought/subscriptions","organizations_url":"https://api.github.com/users/enthought/orgs","repos_url":"https://api.github.com/users/enthought/repos","events_url":"https://api.github.com/users/enthought/events{/privacy}","received_events_url":"https://api.github.com/users/enthought/received_events","type":"Organization","site_admin":false},"repo":{"id":1301745,"name":"traits","full_name":"enthought/traits","owner":{"login":"enthought","id":539651,"avatar_url":"https://avatars.githubusercontent.com/u/539651?v=3","gravatar_id":"","url":"https://api.github.com/users/enthought","html_url":"https://github.com/enthought","followers_url":"https://api.github.com/users/enthought/followers","following_url":"https://api.github.com/users/enthought/following{/other_user}","gists_url":"https://api.github.com/users/enthought/gists{/gist_id}","starred_url":"https://api.github.com/users/enthought/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enthought/subscriptions","organizations_url":"https://api.github.com/users/enthought/orgs","repos_url":"https://api.github.com/users/enthought/repos","events_url":"https://api.github.com/users/enthought/events{/privacy}","received_events_url":"https://api.github.com/users/enthought/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/enthought/traits","description":"Optional type-checking, data dependencies, and event notifications for Python","fork":false,"url":"https://api.github.com/repos/enthought/traits","forks_url":"https://api.github.com/repos/enthought/traits/forks","keys_url":"https://api.github.com/repos/enthought/traits/keys{/key_id}","collaborators_url":"https://api.github.com/repos/enthought/traits/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/enthought/traits/teams","hooks_url":"https://api.github.com/repos/enthought/traits/hooks","issue_events_url":"https://api.github.com/repos/enthought/traits/issues/events{/number}","events_url":"https://api.github.com/repos/enthought/traits/events","assignees_url":"https://api.github.com/repos/enthought/traits/assignees{/user}","branches_url":"https://api.github.com/repos/enthought/traits/branches{/branch}","tags_url":"https://api.github.com/repos/enthought/traits/tags","blobs_url":"https://api.github.com/repos/enthought/traits/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/enthought/traits/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/enthought/traits/git/refs{/sha}","trees_url":"https://api.github.com/repos/enthought/traits/git/trees{/sha}","statuses_url":"https://api.github.com/repos/enthought/traits/statuses/{sha}","languages_url":"https://api.github.com/repos/enthought/traits/languages","stargazers_url":"https://api.github.com/repos/enthought/traits/stargazers","contributors_url":"https://api.github.com/repos/enthought/traits/contributors","subscribers_url":"https://api.github.com/repos/enthought/traits/subscribers","subscription_url":"https://api.github.com/repos/enthought/traits/subscription","commits_url":"https://api.github.com/repos/enthought/traits/commits{/sha}","git_commits_url":"https://api.github.com/repos/enthought/traits/git/commits{/sha}","comments_url":"https://api.github.com/repos/enthought/traits/comments{/number}","issue_comment_url":"https://api.github.com/repos/enthought/traits/issues/comments{/number}","contents_url":"https://api.github.com/repos/enthought/traits/contents/{+path}","compare_url":"https://api.github.com/repos/enthought/traits/compare/{base}...{head}","merges_url":"https://api.github.com/repos/enthought/traits/merges","archive_url":"https://api.github.com/repos/enthought/traits/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/enthought/traits/downloads","issues_url":"https://api.github.com/repos/enthought/traits/issues{/number}","pulls_url":"https://api.github.com/repos/enthought/traits/pulls{/number}","milestones_url":"https://api.github.com/repos/enthought/traits/milestones{/number}","notifications_url":"https://api.github.com/repos/enthought/traits/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/enthought/traits/labels{/name}","releases_url":"https://api.github.com/repos/enthought/traits/releases{/id}","created_at":"2011-01-28T04:46:40Z","updated_at":"2015-12-05T00:13:48Z","pushed_at":"2016-01-04T15:13:44Z","git_url":"git://github.com/enthought/traits.git","ssh_url":"git@github.com:enthought/traits.git","clone_url":"https://github.com/enthought/traits.git","svn_url":"https://github.com/enthought/traits","homepage":"","size":41996,"stargazers_count":125,"watchers_count":125,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":42,"mirror_url":null,"open_issues_count":75,"forks":42,"open_issues":75,"watchers":125,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/enthought/traits/pulls/276"},"html":{"href":"https://github.com/enthought/traits/pull/276"},"issue":{"href":"https://api.github.com/repos/enthought/traits/issues/276"},"comments":{"href":"https://api.github.com/repos/enthought/traits/issues/276/comments"},"review_comments":{"href":"https://api.github.com/repos/enthought/traits/pulls/276/comments"},"review_comment":{"href":"https://api.github.com/repos/enthought/traits/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/enthought/traits/pulls/276/commits"},"statuses":{"href":"https://api.github.com/repos/enthought/traits/statuses/facc1fca046504bb23a58e7585a93ea0e68223ec"}}}}