Hello, Is there a way to access a test's fixtures from the pytest_runtest_call hook?
Specifically, I'd like to access the capfd and caplog fixtures to take a peek at the captured output and cause the test to fail if there is anything suspicious. At the moment, I am checking the captured output by using a autouse yield fixture but this has the drawback that the failure is reported in the teardown rather than the test, and that test is reported twice: first as passed, and then as failed, e.g.: $ py.test-3 tests/mytest.py ============================================ test session starts ============================================ platform linux -- Python 3.4.2, pytest-2.8.7, py-1.4.31, pluggy-0.3.1 -- /usr/bin/python3 cachedir: tests/.cache rootdir: /home/nikratio/in-progress/s3ql/tests, inifile: pytest.ini plugins: catchlog-1.2.1 collected 1 items tests/mytest.py::test_log PASSED tests/mytest.py::test_log ERROR ================================================== ERRORS =================================================== _______________________________________ ERROR at teardown of test_log _______________________________________ Traceback (most recent call last): File "/home/nikratio/in-progress/s3ql/tests/conftest.py", line 48, in check_test_output raise AssertionError('Suspicious output to stderr') AssertionError: Suspicious output to stderr Best, -Nikolaus -- GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F »Time flies like an arrow, fruit flies like a Banana.« _______________________________________________ pytest-dev mailing list pytest-dev@python.org https://mail.python.org/mailman/listinfo/pytest-dev