Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8759133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:43:28+00:00 2026-06-13T14:43:28+00:00

I am using the py.test reporting hooks (pytest_runtest_makereport() and pytest_report_teststatus()). When a py.test test

  • 0

I am using the py.test reporting hooks (pytest_runtest_makereport() and pytest_report_teststatus()).

When a py.test test fails, I can find the captured stdout data in the report hook (at report.sections[]).

When a py.test test passes, the report.sections[] list is empty.

Where can I find the captured stdout for a test that passes?

Thanks.

Edit: From the source (_pytest/capture.py), it looks like this is available only if the test doesn’t pass:

def pytest_runtest_makereport(self, __multicall__, item, call):
    ...
    if not rep.passed:
        addouterr(rep, outerr)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T14:43:29+00:00Added an answer on June 13, 2026 at 2:43 pm

    It turns out that the information is available in item.outerr, which is a tuple of two Unicode strings; the first is stdout, and the second is stderr.

    Note that py.test specifies these strings in the setup, call, and teardown reports, and that some of those could be empty strings. So in order to save the output, without overwriting it with an empty string, the logic needs to be:

    stdout = item.outerr[0]
    if stdout and len(stdout):
        whatever.stdout = stdout
    
    stderr = item.outerr[1]
    if stderr and len(stderr):
        whatever.stderr = stderr
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When running py.test using a plugin that loads xmlrpclib the test run fails with:
We are using MS Access as a reporting front-end for Oracle. The data is
Using the Show/Remove Columns context menu option in the Test Results window I can
Using php's DOMDocument->LoadHTMLFile('test.html'); keeps on returning an error to me, reporting for an error
We are migrating our test report data (unit, regression, integration, etc..) from an XML
I have a report that renders data returned from a stored procedure. Using profiler
When using test fixtures in Django is the convention to include the foreign models
I'm using Test::Unit with shoulda to test a controller. Since I'm just testing the
I'm trying to retrofit some tests using Test::More to legacy code and I've bumped
I'm writing unit tests using Test::More and Test::Output. I use Test::More to validate the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.