Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stdout and stderr not compatible with Jenkins #59

Closed
pytestbot opened this issue Jul 6, 2011 · 8 comments
Closed

stdout and stderr not compatible with Jenkins #59

pytestbot opened this issue Jul 6, 2011 · 8 comments
Labels
type: enhancement new feature or API change, should be merged into features branch

Comments

@pytestbot
Copy link
Contributor

Originally reported by: Anonymous


When using the junitxml flag, it outputs all the traceback, stderr and stdout into Jenkins' stacktrace. The stderr and stdout should be put into and respectively instead of everything in . This will make the xml output more compatible with Jenkins and plugins.


@pytestbot
Copy link
Contributor Author

Original comment by Brian O'Neill (BitBucket: sfbrian, GitHub: sfbrian):


This is who reported the bug in case you have more questions.

@pytestbot
Copy link
Contributor Author

Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):


i see.

curious, can you point to a Jenkins page that makes use of system-out/system-err?

@pytestbot
Copy link
Contributor Author

Original comment by Brian O'Neill (BitBucket: sfbrian, GitHub: sfbrian):


Here is an example of Jenkins using stdout. We made a hack to put all the stdout and stderr into Jenkins' stdout to get a quick fix: https://skitch.com/boneill428/fj8q2/stdout

Our hack was:

sed -i -e 's###g'
-e 's#------------------------------- Captured stdout --------------------------------##g'
results.xml

@pytestbot
Copy link
Contributor Author

Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):


fix #59: provide better Jenkins stdout and stderr sections

@pytestbot
Copy link
Contributor Author

Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):


could you verify it works for you by installing:

pip install -i http://pypi.testrun.org -U pytest

? should give you pytest-2.1.1.dev2 at least (see py.test -v) and better xml files. I wasn't 100% sure how the xml format looks like - if there are issues, please provide an exmaple xml file.

thanks,
holger

@pytestbot
Copy link
Contributor Author

Original comment by Brian O'Neill (BitBucket: sfbrian, GitHub: sfbrian):


Thanks for the fix Holger. One minor change is needed. The format should be:
{{{

_Traceback_

**_System Out**_ **_System Error**_

}}}

Currently the format is wrapped in the failure tag instead at the same level as failure:
{{{

**_Trackback**_ **_System Out**_
<system-err>
***System Error***
</system-err>
}}}

Example:

{{{
self = <general.GeneralTest testMethod=test_help_page>

def test_help_page(self):
    self.navigate_to_help_page()

> exit()

general.py:84:


self = Use exit() or Ctrl-D (i.e. EOF) to exit, code = None

def __call__(self, code=None):
    # Shells like IDLE catch the SystemExit, but listen when their
    # stdin wrapper is closed.
    try:
        sys.stdin.close()
    except:
        pass

> raise SystemExit(code)
E SystemExit: None

/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site.py:334: SystemExit
SauceOnDemandSessionID=null job-name=foo

2011-07-12 15:20:49,608 - logger - INFO - Sauce Labs Video: https://saucelabs.com/jobs/null
2011-07-12 15:20:49,608 - logger - INFO - test_help_page Started
2011-07-12 15:20:53,392 - logger - INFO - test_help_page Finished

}}}

@pytestbot
Copy link
Contributor Author

Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):


thanks, i think i fixed it. See "pip install -i http://pypi.testrun.org -U pytest" (version dev3 now)

@pytestbot
Copy link
Contributor Author

Original comment by Brian O'Neill (BitBucket: sfbrian, GitHub: sfbrian):


Looks great! Thanks for the fix. You rock!

@pytestbot pytestbot added the type: enhancement new feature or API change, should be merged into features branch label Jun 15, 2015
fkohlgrueber pushed a commit to fkohlgrueber/pytest that referenced this issue Oct 27, 2018
fkohlgrueber pushed a commit to fkohlgrueber/pytest that referenced this issue Oct 27, 2018
mgorny pushed a commit to mgorny/pytest that referenced this issue May 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement new feature or API change, should be merged into features branch
Projects
None yet
Development

No branches or pull requests

1 participant