{"action":"created","comment":{"url":"https://api.github.com/repos/pytest-dev/pytest/pulls/comments/177008462","pull_request_review_id":106805706,"id":177008462,"diff_hunk":"@@ -49,6 +49,66 @@ def test_foo():\n                                  'text going to stderr'])\n \n \n+def test_root_logger_affected(testdir):\n+    testdir.makepyfile('''\n+        import logging\n+        logger = logging.getLogger()\n+        def test_foo():\n+            logger.info('info text ' + 'going to logger')\n+            logger.warning('warning text ' + 'going to logger')\n+            logger.error('error text ' + 'going to logger')\n+\n+            assert 0\n+        ''')\n+    log_file = testdir.tmpdir.join('pytest.log').strpath\n+    result = testdir.runpytest('--log-level=ERROR', '--log-file=pytest.log')\n+    assert result.ret == 1\n+\n+    # the capture log calls in the stdout section only contain the\n+    # logger.error msg, because --log-level=ERROR\n+    result.stdout.fnmatch_lines(['*error text going to logger*'])\n+    with pytest.raises(pytest.fail.Exception):\n+        result.stdout.fnmatch_lines(['*warning text going to logger*'])\n+    with pytest.raises(pytest.fail.Exception):\n+        result.stdout.fnmatch_lines(['*info text going to logger*'])\n+\n+    # the log file should contain the warning and the error log messages and\n+    # not the info one, because the default level of the root logger is\n+    # WARNING.\n+    assert os.path.isfile(log_file)\n+    with open(log_file) as rfh:\n+        contents = rfh.read()\n+        assert \"info text going to logger\" not in contents\n+        assert \"warning text going to logger\" in contents\n+        assert \"error text going to logger\" in contents\n+\n+\n+def test_log_cli_level_log_level_interaction(testdir):\n+    testdir.makepyfile('''\n+    import logging","path":"testing/logging/test_reporting.py","position":null,"original_position":40,"commit_id":"d895f5d6fce13981f11cfc6c47e2c12474a3f07f","original_commit_id":"701b2552df04b951281b42d26ca078e80c2129da","user":{"login":"KKoukiou","id":14921356,"avatar_url":"https://avatars1.githubusercontent.com/u/14921356?v=4","gravatar_id":"","url":"https://api.github.com/users/KKoukiou","html_url":"https://github.com/KKoukiou","followers_url":"https://api.github.com/users/KKoukiou/followers","following_url":"https://api.github.com/users/KKoukiou/following{/other_user}","gists_url":"https://api.github.com/users/KKoukiou/gists{/gist_id}","starred_url":"https://api.github.com/users/KKoukiou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KKoukiou/subscriptions","organizations_url":"https://api.github.com/users/KKoukiou/orgs","repos_url":"https://api.github.com/users/KKoukiou/repos","events_url":"https://api.github.com/users/KKoukiou/events{/privacy}","received_events_url":"https://api.github.com/users/KKoukiou/received_events","type":"User","site_admin":false},"body":"Done","created_at":"2018-03-26T08:12:36Z","updated_at":"2018-03-26T08:12:36Z","html_url":"https://github.com/pytest-dev/pytest/pull/3307#discussion_r177008462","pull_request_url":"https://api.github.com/repos/pytest-dev/pytest/pulls/3307","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/pytest-dev/pytest/pulls/comments/177008462"},"html":{"href":"https://github.com/pytest-dev/pytest/pull/3307#discussion_r177008462"},"pull_request":{"href":"https://api.github.com/repos/pytest-dev/pytest/pulls/3307"}},"in_reply_to_id":176936670},"pull_request":{"url":"https://api.github.com/repos/pytest-dev/pytest/pulls/3307","id":174887533,"html_url":"https://github.com/pytest-dev/pytest/pull/3307","diff_url":"https://github.com/pytest-dev/pytest/pull/3307.diff","patch_url":"https://github.com/pytest-dev/pytest/pull/3307.patch","issue_url":"https://api.github.com/repos/pytest-dev/pytest/issues/3307","number":3307,"state":"open","locked":false,"title":"logging.py: Don't change log level of the root logger to bigger numeric value","user":{"login":"KKoukiou","id":14921356,"avatar_url":"https://avatars1.githubusercontent.com/u/14921356?v=4","gravatar_id":"","url":"https://api.github.com/users/KKoukiou","html_url":"https://github.com/KKoukiou","followers_url":"https://api.github.com/users/KKoukiou/followers","following_url":"https://api.github.com/users/KKoukiou/following{/other_user}","gists_url":"https://api.github.com/users/KKoukiou/gists{/gist_id}","starred_url":"https://api.github.com/users/KKoukiou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KKoukiou/subscriptions","organizations_url":"https://api.github.com/users/KKoukiou/orgs","repos_url":"https://api.github.com/users/KKoukiou/repos","events_url":"https://api.github.com/users/KKoukiou/events{/privacy}","received_events_url":"https://api.github.com/users/KKoukiou/received_events","type":"User","site_admin":false},"body":"When doing log capturing we need to temporary change the level of the root logger to be at least\r\nof the log level that the handler used for log capturing has (log_level), so that we 'll be able to capture such  logs.\r\n\r\nIf root logger level has smaller numeric value than `log_level` parameter we should not enforce root logger level to `log_level` because we might miss important logs from root logger gathered by other handlers.","created_at":"2018-03-14T08:51:59Z","updated_at":"2018-03-26T08:12:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e45243bf2f4edff965b8d7f37b4e43b6c74fff01","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/pytest-dev/pytest/pulls/3307/commits","review_comments_url":"https://api.github.com/repos/pytest-dev/pytest/pulls/3307/comments","review_comment_url":"https://api.github.com/repos/pytest-dev/pytest/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pytest-dev/pytest/issues/3307/comments","statuses_url":"https://api.github.com/repos/pytest-dev/pytest/statuses/d895f5d6fce13981f11cfc6c47e2c12474a3f07f","head":{"label":"KKoukiou:rhv-qe-fix","ref":"rhv-qe-fix","sha":"d895f5d6fce13981f11cfc6c47e2c12474a3f07f","user":{"login":"KKoukiou","id":14921356,"avatar_url":"https://avatars1.githubusercontent.com/u/14921356?v=4","gravatar_id":"","url":"https://api.github.com/users/KKoukiou","html_url":"https://github.com/KKoukiou","followers_url":"https://api.github.com/users/KKoukiou/followers","following_url":"https://api.github.com/users/KKoukiou/following{/other_user}","gists_url":"https://api.github.com/users/KKoukiou/gists{/gist_id}","starred_url":"https://api.github.com/users/KKoukiou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KKoukiou/subscriptions","organizations_url":"https://api.github.com/users/KKoukiou/orgs","repos_url":"https://api.github.com/users/KKoukiou/repos","events_url":"https://api.github.com/users/KKoukiou/events{/privacy}","received_events_url":"https://api.github.com/users/KKoukiou/received_events","type":"User","site_admin":false},"repo":{"id":74478330,"name":"pytest","full_name":"KKoukiou/pytest","owner":{"login":"KKoukiou","id":14921356,"avatar_url":"https://avatars1.githubusercontent.com/u/14921356?v=4","gravatar_id":"","url":"https://api.github.com/users/KKoukiou","html_url":"https://github.com/KKoukiou","followers_url":"https://api.github.com/users/KKoukiou/followers","following_url":"https://api.github.com/users/KKoukiou/following{/other_user}","gists_url":"https://api.github.com/users/KKoukiou/gists{/gist_id}","starred_url":"https://api.github.com/users/KKoukiou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KKoukiou/subscriptions","organizations_url":"https://api.github.com/users/KKoukiou/orgs","repos_url":"https://api.github.com/users/KKoukiou/repos","events_url":"https://api.github.com/users/KKoukiou/events{/privacy}","received_events_url":"https://api.github.com/users/KKoukiou/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/KKoukiou/pytest","description":"The pytest framework makes it easy to write small tests, yet scales to support complex functional testing","fork":true,"url":"https://api.github.com/repos/KKoukiou/pytest","forks_url":"https://api.github.com/repos/KKoukiou/pytest/forks","keys_url":"https://api.github.com/repos/KKoukiou/pytest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/KKoukiou/pytest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/KKoukiou/pytest/teams","hooks_url":"https://api.github.com/repos/KKoukiou/pytest/hooks","issue_events_url":"https://api.github.com/repos/KKoukiou/pytest/issues/events{/number}","events_url":"https://api.github.com/repos/KKoukiou/pytest/events","assignees_url":"https://api.github.com/repos/KKoukiou/pytest/assignees{/user}","branches_url":"https://api.github.com/repos/KKoukiou/pytest/branches{/branch}","tags_url":"https://api.github.com/repos/KKoukiou/pytest/tags","blobs_url":"https://api.github.com/repos/KKoukiou/pytest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/KKoukiou/pytest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/KKoukiou/pytest/git/refs{/sha}","trees_url":"https://api.github.com/repos/KKoukiou/pytest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/KKoukiou/pytest/statuses/{sha}","languages_url":"https://api.github.com/repos/KKoukiou/pytest/languages","stargazers_url":"https://api.github.com/repos/KKoukiou/pytest/stargazers","contributors_url":"https://api.github.com/repos/KKoukiou/pytest/contributors","subscribers_url":"https://api.github.com/repos/KKoukiou/pytest/subscribers","subscription_url":"https://api.github.com/repos/KKoukiou/pytest/subscription","commits_url":"https://api.github.com/repos/KKoukiou/pytest/commits{/sha}","git_commits_url":"https://api.github.com/repos/KKoukiou/pytest/git/commits{/sha}","comments_url":"https://api.github.com/repos/KKoukiou/pytest/comments{/number}","issue_comment_url":"https://api.github.com/repos/KKoukiou/pytest/issues/comments{/number}","contents_url":"https://api.github.com/repos/KKoukiou/pytest/contents/{+path}","compare_url":"https://api.github.com/repos/KKoukiou/pytest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/KKoukiou/pytest/merges","archive_url":"https://api.github.com/repos/KKoukiou/pytest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/KKoukiou/pytest/downloads","issues_url":"https://api.github.com/repos/KKoukiou/pytest/issues{/number}","pulls_url":"https://api.github.com/repos/KKoukiou/pytest/pulls{/number}","milestones_url":"https://api.github.com/repos/KKoukiou/pytest/milestones{/number}","notifications_url":"https://api.github.com/repos/KKoukiou/pytest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/KKoukiou/pytest/labels{/name}","releases_url":"https://api.github.com/repos/KKoukiou/pytest/releases{/id}","deployments_url":"https://api.github.com/repos/KKoukiou/pytest/deployments","created_at":"2016-11-22T14:05:31Z","updated_at":"2016-11-22T14:05:33Z","pushed_at":"2018-03-26T08:12:08Z","git_url":"git://github.com/KKoukiou/pytest.git","ssh_url":"git@github.com:KKoukiou/pytest.git","clone_url":"https://github.com/KKoukiou/pytest.git","svn_url":"https://github.com/KKoukiou/pytest","homepage":"http://pytest.org/","size":11612,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pytest-dev:features","ref":"features","sha":"ed118d7f2051ccfdb5c56cb6535e6f89485b1225","user":{"login":"pytest-dev","id":8897583,"avatar_url":"https://avatars2.githubusercontent.com/u/8897583?v=4","gravatar_id":"","url":"https://api.github.com/users/pytest-dev","html_url":"https://github.com/pytest-dev","followers_url":"https://api.github.com/users/pytest-dev/followers","following_url":"https://api.github.com/users/pytest-dev/following{/other_user}","gists_url":"https://api.github.com/users/pytest-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/pytest-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pytest-dev/subscriptions","organizations_url":"https://api.github.com/users/pytest-dev/orgs","repos_url":"https://api.github.com/users/pytest-dev/repos","events_url":"https://api.github.com/users/pytest-dev/events{/privacy}","received_events_url":"https://api.github.com/users/pytest-dev/received_events","type":"Organization","site_admin":false},"repo":{"id":37489525,"name":"pytest","full_name":"pytest-dev/pytest","owner":{"login":"pytest-dev","id":8897583,"avatar_url":"https://avatars2.githubusercontent.com/u/8897583?v=4","gravatar_id":"","url":"https://api.github.com/users/pytest-dev","html_url":"https://github.com/pytest-dev","followers_url":"https://api.github.com/users/pytest-dev/followers","following_url":"https://api.github.com/users/pytest-dev/following{/other_user}","gists_url":"https://api.github.com/users/pytest-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/pytest-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pytest-dev/subscriptions","organizations_url":"https://api.github.com/users/pytest-dev/orgs","repos_url":"https://api.github.com/users/pytest-dev/repos","events_url":"https://api.github.com/users/pytest-dev/events{/privacy}","received_events_url":"https://api.github.com/users/pytest-dev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pytest-dev/pytest","description":"The pytest framework makes it easy to write small tests, yet scales to support complex functional testing","fork":false,"url":"https://api.github.com/repos/pytest-dev/pytest","forks_url":"https://api.github.com/repos/pytest-dev/pytest/forks","keys_url":"https://api.github.com/repos/pytest-dev/pytest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pytest-dev/pytest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pytest-dev/pytest/teams","hooks_url":"https://api.github.com/repos/pytest-dev/pytest/hooks","issue_events_url":"https://api.github.com/repos/pytest-dev/pytest/issues/events{/number}","events_url":"https://api.github.com/repos/pytest-dev/pytest/events","assignees_url":"https://api.github.com/repos/pytest-dev/pytest/assignees{/user}","branches_url":"https://api.github.com/repos/pytest-dev/pytest/branches{/branch}","tags_url":"https://api.github.com/repos/pytest-dev/pytest/tags","blobs_url":"https://api.github.com/repos/pytest-dev/pytest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pytest-dev/pytest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pytest-dev/pytest/git/refs{/sha}","trees_url":"https://api.github.com/repos/pytest-dev/pytest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pytest-dev/pytest/statuses/{sha}","languages_url":"https://api.github.com/repos/pytest-dev/pytest/languages","stargazers_url":"https://api.github.com/repos/pytest-dev/pytest/stargazers","contributors_url":"https://api.github.com/repos/pytest-dev/pytest/contributors","subscribers_url":"https://api.github.com/repos/pytest-dev/pytest/subscribers","subscription_url":"https://api.github.com/repos/pytest-dev/pytest/subscription","commits_url":"https://api.github.com/repos/pytest-dev/pytest/commits{/sha}","git_commits_url":"https://api.github.com/repos/pytest-dev/pytest/git/commits{/sha}","comments_url":"https://api.github.com/repos/pytest-dev/pytest/comments{/number}","issue_comment_url":"https://api.github.com/repos/pytest-dev/pytest/issues/comments{/number}","contents_url":"https://api.github.com/repos/pytest-dev/pytest/contents/{+path}","compare_url":"https://api.github.com/repos/pytest-dev/pytest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pytest-dev/pytest/merges","archive_url":"https://api.github.com/repos/pytest-dev/pytest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pytest-dev/pytest/downloads","issues_url":"https://api.github.com/repos/pytest-dev/pytest/issues{/number}","pulls_url":"https://api.github.com/repos/pytest-dev/pytest/pulls{/number}","milestones_url":"https://api.github.com/repos/pytest-dev/pytest/milestones{/number}","notifications_url":"https://api.github.com/repos/pytest-dev/pytest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pytest-dev/pytest/labels{/name}","releases_url":"https://api.github.com/repos/pytest-dev/pytest/releases{/id}","deployments_url":"https://api.github.com/repos/pytest-dev/pytest/deployments","created_at":"2015-06-15T20:28:27Z","updated_at":"2018-03-26T07:04:06Z","pushed_at":"2018-03-26T08:12:11Z","git_url":"git://github.com/pytest-dev/pytest.git","ssh_url":"git@github.com:pytest-dev/pytest.git","clone_url":"https://github.com/pytest-dev/pytest.git","svn_url":"https://github.com/pytest-dev/pytest","homepage":"http://pytest.org/","size":11776,"stargazers_count":2354,"watchers_count":2354,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":608,"mirror_url":null,"archived":false,"open_issues_count":437,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":608,"open_issues":437,"watchers":2354,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pytest-dev/pytest/pulls/3307"},"html":{"href":"https://github.com/pytest-dev/pytest/pull/3307"},"issue":{"href":"https://api.github.com/repos/pytest-dev/pytest/issues/3307"},"comments":{"href":"https://api.github.com/repos/pytest-dev/pytest/issues/3307/comments"},"review_comments":{"href":"https://api.github.com/repos/pytest-dev/pytest/pulls/3307/comments"},"review_comment":{"href":"https://api.github.com/repos/pytest-dev/pytest/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pytest-dev/pytest/pulls/3307/commits"},"statuses":{"href":"https://api.github.com/repos/pytest-dev/pytest/statuses/d895f5d6fce13981f11cfc6c47e2c12474a3f07f"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"KKoukiou"}}