{"action":"created","issue":{"url":"https://api.github.com/repos/pytest-dev/pytest-qt/issues/113","labels_url":"https://api.github.com/repos/pytest-dev/pytest-qt/issues/113/labels{/name}","comments_url":"https://api.github.com/repos/pytest-dev/pytest-qt/issues/113/comments","events_url":"https://api.github.com/repos/pytest-dev/pytest-qt/issues/113/events","html_url":"https://github.com/pytest-dev/pytest-qt/issues/113","id":119375290,"number":113,"title":"Captured output leaking","user":{"login":"The-Compiler","id":625793,"avatar_url":"https://avatars.githubusercontent.com/u/625793?v=3","gravatar_id":"","url":"https://api.github.com/users/The-Compiler","html_url":"https://github.com/The-Compiler","followers_url":"https://api.github.com/users/The-Compiler/followers","following_url":"https://api.github.com/users/The-Compiler/following{/other_user}","gists_url":"https://api.github.com/users/The-Compiler/gists{/gist_id}","starred_url":"https://api.github.com/users/The-Compiler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/The-Compiler/subscriptions","organizations_url":"https://api.github.com/users/The-Compiler/orgs","repos_url":"https://api.github.com/users/The-Compiler/repos","events_url":"https://api.github.com/users/The-Compiler/events{/privacy}","received_events_url":"https://api.github.com/users/The-Compiler/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-11-29T18:23:44Z","updated_at":"2015-12-18T05:11:06Z","closed_at":null,"body":"I recently updated to pytest 2.8 and noticed I got output which should be captured on stdout.\r\n\r\nThis is during tests which launch a subprocess via `QProcess` which then does logging on stderr, which is printed during the tests (see [testprocess.py](https://github.com/The-Compiler/qutebrowser/blob/master/tests/integration/testprocess.py) / [quteprocess.py](https://github.com/The-Compiler/qutebrowser/blob/master/tests/integration/quteprocess.py#L156)).\r\n\r\nI was able to reproduce this with this example:\r\n\r\n```python\r\nimport pytest\r\nfrom PyQt5.QtCore import QTimer\r\n\r\n\r\n@pytest.yield_fixture(scope='module')\r\ndef timer():\r\n    t = QTimer()\r\n    t.setInterval(10)\r\n    t.timeout.connect(lambda: print(\"foo\"))\r\n    t.start()\r\n    yield t\r\n    t.stop()\r\n\r\n\r\n@pytest.mark.parametrize('x', range(1000))\r\ndef test_foo(qtbot, timer, x):\r\n    qtbot.waitSignal(timer.timeout)\r\n```\r\n\r\nWhen running it with pytest 2.7.3:\r\n\r\n```\r\n============================================= test session starts ==============================================\r\nplatform linux -- Python 3.5.0 -- py-1.4.31 -- pytest-2.7.3\r\nPyQt5 5.5.1 -- Qt runtime 5.5.1 -- Qt compiled 5.5.1\r\nrootdir: /home/florian/proj/pytest, inifile: tox.ini\r\nplugins: qt\r\ncollected 1000 items \r\n\r\ntestcap2.py ...[…]...\r\n\r\n========================================= 1000 passed in 1.16 seconds ==========================================\r\n```\r\n\r\nwith 2.8.2:\r\n\r\n```\r\n============================================= test session starts ==============================================\r\nplatform linux -- Python 3.5.0, pytest-2.8.2, py-1.4.31, pluggy-0.3.1\r\nPyQt5 5.5.1 -- Qt runtime 5.5.1 -- Qt compiled 5.5.1\r\nrootdir: /home/florian/proj/pytest, inifile: tox.ini\r\nplugins: qt-1.9.0\r\ncollected 1000 items \r\n\r\ntestcap2.py .........foo\r\n.........foo\r\n.........foo\r\n..........foo\r\n...................foo\r\n[…]\r\n\r\n========================================= 1000 passed in 1.17 seconds ==========================================\r\n```\r\n\r\nI bisected this to https://github.com/pytest-dev/pytest/commit/c54afbe42e7e47afb7605f4bc226af92dbeda0a7 (\"deprecate and warn about `__multicall__` usage in hooks, refine docs about hook ordering, make hookwrappers respect tryfirst/trylast\").\r\n\r\nI also tried reproducing it without pytest-qt but it only seems to happen with pytest-qt.\r\n\r\nI'm guessing the event processing happens after pytest already has lifted the capturing, and that commit changed something about the order things are done?\r\n"},"comment":{"url":"https://api.github.com/repos/pytest-dev/pytest-qt/issues/comments/165674621","html_url":"https://github.com/pytest-dev/pytest-qt/issues/113#issuecomment-165674621","issue_url":"https://api.github.com/repos/pytest-dev/pytest-qt/issues/113","id":165674621,"user":{"login":"The-Compiler","id":625793,"avatar_url":"https://avatars.githubusercontent.com/u/625793?v=3","gravatar_id":"","url":"https://api.github.com/users/The-Compiler","html_url":"https://github.com/The-Compiler","followers_url":"https://api.github.com/users/The-Compiler/followers","following_url":"https://api.github.com/users/The-Compiler/following{/other_user}","gists_url":"https://api.github.com/users/The-Compiler/gists{/gist_id}","starred_url":"https://api.github.com/users/The-Compiler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/The-Compiler/subscriptions","organizations_url":"https://api.github.com/users/The-Compiler/orgs","repos_url":"https://api.github.com/users/The-Compiler/repos","events_url":"https://api.github.com/users/The-Compiler/events{/privacy}","received_events_url":"https://api.github.com/users/The-Compiler/received_events","type":"User","site_admin":false},"created_at":"2015-12-18T05:11:05Z","updated_at":"2015-12-18T05:11:05Z","body":"@flub let's see what @nicoddemus says - but if I understand the underlying issue correctly, indeed."}}