Skip to content

Commit

Permalink
WIP: use hookwrapper to handle items in the end
Browse files Browse the repository at this point in the history
This allows for proper grouping when using e.g. `-k`: items will be
narrowed down already by then.

TODO:
 - [ ] will throw an "Invalid test-group argument" when `-k` selects
   only a single test and you use test-group-count=2 test-group=2.
  • Loading branch information
blueyed committed Feb 10, 2018
1 parent 13f1f7a commit cb0b07c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pytest_test_groups/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import math
from random import Random

import pytest

from random import Random

Expand Down Expand Up @@ -27,7 +30,9 @@ def pytest_addoption(parser):
help='Integer to seed pseudo-random test ordering')


@pytest.hookimpl(hookwrapper=True)
def pytest_collection_modifyitems(session, config, items):
yield
group_count = config.getoption('test-group-count')
group_id = config.getoption('test-group')
seed = config.getoption('random-seed', False)
Expand Down

0 comments on commit cb0b07c

Please sign in to comment.