(config, items)
| 62 | |
| 63 | |
| 64 | def pytest_collection_modifyitems(config, items): |
| 65 | if not all(k in os.environ for k in ["CI", "TVM_NUM_SHARDS", "TVM_SHARD_INDEX"]): |
| 66 | # Only apportion tests if in CI and in a job that is set up for it |
| 67 | return |
| 68 | |
| 69 | num_shards = int(os.environ["TVM_NUM_SHARDS"]) |
| 70 | shard_index = int(os.environ["TVM_SHARD_INDEX"]) |
| 71 | |
| 72 | print(f"Marking tests for shard {shard_index} of {num_shards}") |
| 73 | items_copy = list(items) |
| 74 | for item in items_copy: |
| 75 | item_shard_index = find_shard_index(item.nodeid, num_shards=num_shards) |
| 76 | if item_shard_index != shard_index: |
| 77 | items.remove(item) |
| 78 | |
| 79 | |
| 80 | def pytest_sessionstart(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…