-
Notifications
You must be signed in to change notification settings - Fork 231
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
test item metadata on the master #19
Comments
Here's an idea: Create a hook that is called after collection on the slaves, something like: def pytest_xdist_collect_modify_meta(item, meta):
"""called during collection for each test item. Plugins can
then update the `meta` dictionary with information from the collected item
that will be sent back to the master worker.
keys and values in the `meta` dictionary can contain only
builtin types (strings, ints, tuples, dicts, lists).
""" Each worker after collection (probably in
The @hookspec(firstresult=True)
def pytest_xdist_divide_chunks(items, meta_dict):
"""called by the master worker, plugins can override to split the list of
items into chunks.
`meta_dict` is a dict of `item-nodeid(str) -> meta(dict)`
This hook should return a list of chunks of test items. Each chunk is
guaranteed to execute in the same slave. As an special case, a "chunk"
might be an item instead of a list.
For example, suppose a hook receives a list of items as such (assume the
numbers are actually nodeid strings):
[0, 1, 2, 3, 4, 5]
And wants tests 0, 1, and 2 to execute in the same slave, it should return:
[[0, 1, 2], 3, 4, 5]
"""
The idea here is to add some flexibility to A few more considerations:
|
Good work on the draft All workers should collect all metadata, The hook should not be allowed to modify, only add |
to sanely address #17 and #18 its very helpful if the master can know about fixtures and fixture scopes
The text was updated successfully, but these errors were encountered: