[Pytest-commit] Issue #556: Improve report when slaves collect different tests (hpk42/pytest)

Bruno Oliveira issues-reply at bitbucket.org
Sun Aug 3 01:07:20 CEST 2014


New issue 556: Improve report when slaves collect different tests
https://bitbucket.org/hpk42/pytest/issue/556/improve-report-when-slaves-collect

Bruno Oliveira:

As described in #437 and #301, a test run stops when slaves collect a different number of tests.

The code that raises the error is:

```python
    # dsession.py:147    
    def init_distribute(self):
        assert self.collection_is_completed
        # XXX allow nodes to have different collections
        node_collection_items = list(self.node2collection.items())
        first_node, col = node_collection_items[0]
        for node, collection in node_collection_items[1:]:
            report_collection_diff(
                col,
                collection,
                first_node.gateway.id,
                node.gateway.id,
            )
```

If instead of raising an `AssertionError` in `report_collection_diff` we just `return None` if the collections differ, we obtain a better error message.

```
scheduling tests via LoadScheduling

=================================== ERRORS ====================================
_______ ERROR collecting source/python/ben10/_tests/pytest_fixtures.py ________
.env27\lib\site-packages\py\_path\local.py:620: in pyimport
    __import__(modname)
x:\pytest_cx_freeze\pytest\_pytest\assertion\rewrite.py:134: in find_module
    co = _read_pyc(fn_pypath, pyc)
x:\pytest_cx_freeze\pytest\_pytest\assertion\rewrite.py:312: in _read_pyc
    co = marshal.load(fp)
E   EOFError: EOF read where object expected
```

Which makes it easy to track down the source of the problem (btw, the above issue has a proposed fix in pull request 192).







More information about the pytest-commit mailing list