--- you can reply above this line ---

New issue 271: IOError when writing --junitxml report when run via xdist, 
sometimes
https://bitbucket.org/hpk42/pytest/issue/271/ioerror-when-writing-junitxml-report-when

reuben fletcher-costin:

Hi,

py.test crashed 3 out of 10 times when using py.test -n8 --junitxml report.xml 
to run the following trivial test:

```
#!python

def test_foo():
    assert True
```

When it crashes, the output looks like this (although sometimes more than 1 
node may crash per run):

```
#!text

C:\test_pytest>py.test -n8 --junitxml report.xml
===================================================================== test 
session starts ====================
platform win32 -- Python 2.7.3 -- pytest-2.3.4
plugins: cov, xdist
gw0 [0] / gw1 [0] / gw2 [0] / gw3 [0] / gw4 [0] / gw5 [0] / gw6 [0] / gw7 [0]
scheduling tests via LoadScheduling
[gw5] node down: Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\execnet\gateway_base.py", line 800, in 
executetask
    do_exec(co, loc)
  File "<string>", line 1, in do_exec
  File "", line 139, in <module>
  File "C:\Python27\lib\site-packages\_pytest\core.py", line 422, in __call__
    return self._docall(methods, kwargs)
  File "C:\Python27\lib\site-packages\_pytest\core.py", line 433, in _docall
    res = mc.execute()
  File "C:\Python27\lib\site-packages\_pytest\core.py", line 351, in execute
    res = method(**kwargs)
  File "C:\Python27\lib\site-packages\_pytest\main.py", line 107, in 
pytest_cmdline_main
    return wrap_session(config, _main)
  File "C:\Python27\lib\site-packages\_pytest\main.py", line 99, in wrap_session
    exitstatus=session.exitstatus or (session._testsfailed and 1))
  File "C:\Python27\lib\site-packages\_pytest\core.py", line 422, in __call__
    return self._docall(methods, kwargs)
  File "C:\Python27\lib\site-packages\_pytest\core.py", line 433, in _docall
    res = mc.execute()
  File "C:\Python27\lib\site-packages\_pytest\core.py", line 351, in execute
    res = method(**kwargs)
  File "C:\Python27\lib\site-packages\_pytest\junitxml.py", line 202, in 
pytest_sessionfinish
    logfile = py.std.codecs.open(self.logfile, 'w', encoding='utf-8')
  File "C:\Python27\lib\codecs.py", line 881, in open
    file = __builtin__.open(filename, mode, buffering)
IOError: [Errno 22] invalid mode ('wb') or filename: 
'C:\\test_pytest\\report.xml'


-------------------------------------------------------- generated xml file: 
C:\test_pytest\report.xml -------
======================================================================  in 1.47 
seconds ======================
```

These results are from windows 7 professional with python 2.7.3, running on a 
machine with four cores:

```
#!text

py.test --version
This is py.test version 2.3.4, imported from 
C:\Python27\lib\site-packages\pytest.pyc
setuptools registered plugins:
  pytest-cov-1.6 at C:\Python27\lib\site-packages\pytest_cov.pyc
  pytest-xdist-1.8 at C:\Python27\lib\site-packages\xdist\plugin.pyc

python --version
Python 2.7.3

>>> import execnet
>>> execnet.__version__
'1.1'
```

My guess: perhaps each node is writing its own copy of the xml report to the 
same filename.


--

This is an issue notification from bitbucket.org. You are receiving
this either because you are the owner of the issue, or you are
following the issue.
_______________________________________________
pytest-commit mailing list
pytest-commit@python.org
http://mail.python.org/mailman/listinfo/pytest-commit

Reply via email to