{"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-lint/pulls/comments/86326884","pull_request_review_id":6989339,"id":86326884,"diff_hunk":"@@ -0,0 +1,69 @@\n+\"\"\"Unit tests for required-base-classes.\"\"\"\n+\n+import astroid\n+from pylint.testutils import CheckerTestCase, Message, set_config\n+\n+from edx_lint.pylint.required_base_class import RequiredBaseClassChecker\n+\n+\n+class RequiredBaseClassTestCase(CheckerTestCase):\n+    \"\"\"Unittest tests of RequiredBaseClassChecker.\"\"\"\n+\n+    CHECKER_CLASS = RequiredBaseClassChecker\n+\n+    def get_class_node(self, code):\n+        \"\"\"Parse `code`, and return the last class node.\n+\n+        The code should have at least one class definition.\n+\n+        \"\"\"\n+        node = astroid.parse(code)","path":"test/test_required_base_class.py","position":20,"original_position":20,"commit_id":"ab25d9004b87d1d5f787f8e8fa8345b15d4a511f","original_commit_id":"ab25d9004b87d1d5f787f8e8fa8345b15d4a511f","user":{"login":"PCManticore","id":448166,"avatar_url":"https://avatars.githubusercontent.com/u/448166?v=3","gravatar_id":"","url":"https://api.github.com/users/PCManticore","html_url":"https://github.com/PCManticore","followers_url":"https://api.github.com/users/PCManticore/followers","following_url":"https://api.github.com/users/PCManticore/following{/other_user}","gists_url":"https://api.github.com/users/PCManticore/gists{/gist_id}","starred_url":"https://api.github.com/users/PCManticore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PCManticore/subscriptions","organizations_url":"https://api.github.com/users/PCManticore/orgs","repos_url":"https://api.github.com/users/PCManticore/repos","events_url":"https://api.github.com/users/PCManticore/events{/privacy}","received_events_url":"https://api.github.com/users/PCManticore/received_events","type":"User","site_admin":false},"body":"Maybe you can use astroid.testutils.extract_node / astroid.extract_node for this? It looks something as in:\r\n\r\n```\r\nfrom astroid import extract_node\r\nnode = extract_node('''\r\nclass A:\r\n    pass\r\nclass B: #@\r\n   pass\r\nclass C:\r\n   pass\r\n''')\r\n```\r\n","created_at":"2016-11-03T11:51:11Z","updated_at":"2016-11-03T11:51:28Z","html_url":"https://github.com/edx/edx-lint/pull/50#discussion_r86326884","pull_request_url":"https://api.github.com/repos/edx/edx-lint/pulls/50","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-lint/pulls/comments/86326884"},"html":{"href":"https://github.com/edx/edx-lint/pull/50#discussion_r86326884"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-lint/pulls/50"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-lint/pulls/50","id":91991615,"html_url":"https://github.com/edx/edx-lint/pull/50","diff_url":"https://github.com/edx/edx-lint/pull/50.diff","patch_url":"https://github.com/edx/edx-lint/pull/50.patch","issue_url":"https://api.github.com/repos/edx/edx-lint/issues/50","number":50,"state":"open","locked":false,"title":"Required base classes","user":{"login":"nedbat","id":23789,"avatar_url":"https://avatars.githubusercontent.com/u/23789?v=3","gravatar_id":"","url":"https://api.github.com/users/nedbat","html_url":"https://github.com/nedbat","followers_url":"https://api.github.com/users/nedbat/followers","following_url":"https://api.github.com/users/nedbat/following{/other_user}","gists_url":"https://api.github.com/users/nedbat/gists{/gist_id}","starred_url":"https://api.github.com/users/nedbat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nedbat/subscriptions","organizations_url":"https://api.github.com/users/nedbat/orgs","repos_url":"https://api.github.com/users/nedbat/repos","events_url":"https://api.github.com/users/nedbat/events{/privacy}","received_events_url":"https://api.github.com/users/nedbat/received_events","type":"User","site_admin":false},"body":"This adds a new checker, for required base classes.  A new setting, `required-base-class`, is a list of colon-separated pairs:\r\n```\r\nrequired-base-class: unittest.case.TestCase:common.tests.helpers.TestMixin, ....\r\n```\r\nThis says that if a class derives from TestCase, then it must also derive from TestMixin.  The names must be fully qualified class names.  This is unfortunate in some cases, since like with unittest.case.TestCase, the fully qualified name does not correspond to how it was imported.","created_at":"2016-11-02T15:21:51Z","updated_at":"2016-11-03T11:51:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"76945bf97c7ed33da2ff8099dcb2c0939e3f34a0","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-lint/pulls/50/commits","review_comments_url":"https://api.github.com/repos/edx/edx-lint/pulls/50/comments","review_comment_url":"https://api.github.com/repos/edx/edx-lint/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/edx-lint/issues/50/comments","statuses_url":"https://api.github.com/repos/edx/edx-lint/statuses/ab25d9004b87d1d5f787f8e8fa8345b15d4a511f","head":{"label":"edx:ned/required-base-classes","ref":"ned/required-base-classes","sha":"ab25d9004b87d1d5f787f8e8fa8345b15d4a511f","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":30004785,"name":"edx-lint","full_name":"edx/edx-lint","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-lint","description":"repo to contain any/all pylint checkers","fork":false,"url":"https://api.github.com/repos/edx/edx-lint","forks_url":"https://api.github.com/repos/edx/edx-lint/forks","keys_url":"https://api.github.com/repos/edx/edx-lint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-lint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-lint/teams","hooks_url":"https://api.github.com/repos/edx/edx-lint/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-lint/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-lint/events","assignees_url":"https://api.github.com/repos/edx/edx-lint/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-lint/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-lint/tags","blobs_url":"https://api.github.com/repos/edx/edx-lint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-lint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-lint/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-lint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-lint/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-lint/languages","stargazers_url":"https://api.github.com/repos/edx/edx-lint/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-lint/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-lint/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-lint/subscription","commits_url":"https://api.github.com/repos/edx/edx-lint/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-lint/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-lint/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-lint/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/edx-lint/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-lint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-lint/merges","archive_url":"https://api.github.com/repos/edx/edx-lint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-lint/downloads","issues_url":"https://api.github.com/repos/edx/edx-lint/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-lint/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-lint/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-lint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-lint/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-lint/releases{/id}","deployments_url":"https://api.github.com/repos/edx/edx-lint/deployments","created_at":"2015-01-29T05:14:33Z","updated_at":"2016-10-13T03:30:29Z","pushed_at":"2016-11-02T23:26:10Z","git_url":"git://github.com/edx/edx-lint.git","ssh_url":"git@github.com:edx/edx-lint.git","clone_url":"https://github.com/edx/edx-lint.git","svn_url":"https://github.com/edx/edx-lint","homepage":null,"size":115,"stargazers_count":11,"watchers_count":11,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":3,"forks":4,"open_issues":3,"watchers":11,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"71f973e510b0ad2444b244e5474af4437e16965a","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":30004785,"name":"edx-lint","full_name":"edx/edx-lint","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-lint","description":"repo to contain any/all pylint checkers","fork":false,"url":"https://api.github.com/repos/edx/edx-lint","forks_url":"https://api.github.com/repos/edx/edx-lint/forks","keys_url":"https://api.github.com/repos/edx/edx-lint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-lint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-lint/teams","hooks_url":"https://api.github.com/repos/edx/edx-lint/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-lint/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-lint/events","assignees_url":"https://api.github.com/repos/edx/edx-lint/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-lint/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-lint/tags","blobs_url":"https://api.github.com/repos/edx/edx-lint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-lint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-lint/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-lint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-lint/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-lint/languages","stargazers_url":"https://api.github.com/repos/edx/edx-lint/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-lint/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-lint/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-lint/subscription","commits_url":"https://api.github.com/repos/edx/edx-lint/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-lint/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-lint/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-lint/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/edx-lint/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-lint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-lint/merges","archive_url":"https://api.github.com/repos/edx/edx-lint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-lint/downloads","issues_url":"https://api.github.com/repos/edx/edx-lint/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-lint/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-lint/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-lint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-lint/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-lint/releases{/id}","deployments_url":"https://api.github.com/repos/edx/edx-lint/deployments","created_at":"2015-01-29T05:14:33Z","updated_at":"2016-10-13T03:30:29Z","pushed_at":"2016-11-02T23:26:10Z","git_url":"git://github.com/edx/edx-lint.git","ssh_url":"git@github.com:edx/edx-lint.git","clone_url":"https://github.com/edx/edx-lint.git","svn_url":"https://github.com/edx/edx-lint","homepage":null,"size":115,"stargazers_count":11,"watchers_count":11,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":3,"forks":4,"open_issues":3,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-lint/pulls/50"},"html":{"href":"https://github.com/edx/edx-lint/pull/50"},"issue":{"href":"https://api.github.com/repos/edx/edx-lint/issues/50"},"comments":{"href":"https://api.github.com/repos/edx/edx-lint/issues/50/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-lint/pulls/50/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/edx-lint/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/edx-lint/pulls/50/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-lint/statuses/ab25d9004b87d1d5f787f8e8fa8345b15d4a511f"}}}}
{"actor":{"display_login":"PCManticore"}}