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

MemoryError when writing junitxml for large test suite #641

Closed
pytestbot opened this issue Dec 11, 2014 · 3 comments
Closed

MemoryError when writing junitxml for large test suite #641

pytestbot opened this issue Dec 11, 2014 · 3 comments
Labels
type: bug problem that needs to be addressed
Milestone

Comments

@pytestbot
Copy link
Contributor

Originally reported by: Michael Howitz (BitBucket: icemac, GitHub: icemac)


In a large project (> 3500 Tests) we get a MemoryError when writing the junit xml file.
(The host is our Jenkins CI server with 4 GB of RAM and 2 GB of swap.)

#!python

bin/py.test --nosugar --junitxml=parts/tests.xml --cov-report html --cov-report xml --cov-report term --cov src
============================= test session starts ==============================
platform linux2 -- Python 2.7.6 -- py-1.4.25 -- pytest-2.6.4
plugins: gocept.pytestlayer, cache, cov, sugar, remove-stale-bytecode
collected 3643 items

… Many, many tests which ran fine …

Traceback (most recent call last):
  File "bin/py.test", line 308, in <module>
    sys.exit(pytest.main())
  File "/srv/jenkins/eggs/pytest-2.6.4-py2.7.egg/_pytest/config.py", line 41, in main
    return config.hook.pytest_cmdline_main(config=config)
  File "/srv/jenkins/eggs/pytest-2.6.4-py2.7.egg/_pytest/core.py", line 413, in __call__
    return self._docall(methods, kwargs)
  File "/srv/jenkins/eggs/pytest-2.6.4-py2.7.egg/_pytest/core.py", line 424, in _docall
    res = mc.execute()
  File "/srv/jenkins/eggs/pytest-2.6.4-py2.7.egg/_pytest/core.py", line 315, in execute
    res = method(**kwargs)
  File "/srv/jenkins/eggs/pytest-2.6.4-py2.7.egg/_pytest/main.py", line 116, in pytest_cmdline_main
    return wrap_session(config, _main)
  File "/srv/jenkins/eggs/pytest-2.6.4-py2.7.egg/_pytest/main.py", line 109, in wrap_session
    exitstatus=session.exitstatus)
  File "/srv/jenkins/eggs/pytest-2.6.4-py2.7.egg/_pytest/core.py", line 413, in __call__
    return self._docall(methods, kwargs)
  File "/srv/jenkins/eggs/pytest-2.6.4-py2.7.egg/_pytest/core.py", line 424, in _docall
    res = mc.execute()
  File "/srv/jenkins/eggs/pytest-2.6.4-py2.7.egg/_pytest/core.py", line 315, in execute
    res = method(**kwargs)
  File "/srv/jenkins/eggs/pytest-2.6.4-py2.7.egg/_pytest/terminal.py", line 349, in pytest_sessionfinish
    __multicall__.execute()
  File "/srv/jenkins/eggs/pytest-2.6.4-py2.7.egg/_pytest/core.py", line 315, in execute
    res = method(**kwargs)
  File "/srv/jenkins/eggs/pytest-2.6.4-py2.7.egg/_pytest/junitxml.py", line 215, in pytest_sessionfinish
    ).unicode(indent=0))
  File "/srv/jenkins/eggs/py-1.4.25-py2.7.egg/py/_xmlgen.py", line 54, in unicode
    return u("").join(l)
MemoryError

Any suggestions?


@pytestbot
Copy link
Contributor Author

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


If you don't write the junitxml file py.test completes? How is memory usage evolving during the test run?

@pytestbot
Copy link
Contributor Author

Original comment by Michael Howitz (BitBucket: icemac, GitHub: icemac):


Without the option --junitxml py.test completes. During the test run up to 1,5 GB of RAM is needed. I was not yet able to see the peek when writing the XML file.

When running the tests locally the resulting XML file is about 150 MB.

@pytestbot
Copy link
Contributor Author

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


ok, then it sounds like writing out the xml in a more iterative way should help. py._xmlgen.SimpleUnicodeVisitor might help to achieve that. Not going to try that myself soon but can review a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

2 participants