|
15 | 15 | from xdist.scheduler import LoadGroupScheduling
|
16 | 16 | from xdist.scheduler import LoadScheduling
|
17 | 17 | from xdist.scheduler import LoadScopeScheduling
|
| 18 | +from xdist.scheduler import Scheduling |
18 | 19 | from xdist.scheduler import WorkStealingScheduling
|
19 | 20 | from xdist.workermanage import NodeManager
|
20 | 21 |
|
@@ -97,17 +98,21 @@ def pytest_collection(self):
|
97 | 98 | return True
|
98 | 99 |
|
99 | 100 | @pytest.hookimpl(trylast=True)
|
100 |
| - def pytest_xdist_make_scheduler(self, config, log): |
| 101 | + def pytest_xdist_make_scheduler(self, config, log) -> Scheduling | None: |
101 | 102 | dist = config.getvalue("dist")
|
102 |
| - schedulers = { |
103 |
| - "each": EachScheduling, |
104 |
| - "load": LoadScheduling, |
105 |
| - "loadscope": LoadScopeScheduling, |
106 |
| - "loadfile": LoadFileScheduling, |
107 |
| - "loadgroup": LoadGroupScheduling, |
108 |
| - "worksteal": WorkStealingScheduling, |
109 |
| - } |
110 |
| - return schedulers[dist](config, log) |
| 103 | + if dist == "each": |
| 104 | + return EachScheduling(config, log) |
| 105 | + if dist == "load": |
| 106 | + return LoadScheduling(config, log) |
| 107 | + if dist == "loadscope": |
| 108 | + return LoadScopeScheduling(config, log) |
| 109 | + if dist == "loadfile": |
| 110 | + return LoadFileScheduling(config, log) |
| 111 | + if dist == "loadgroup": |
| 112 | + return LoadGroupScheduling(config, log) |
| 113 | + if dist == "worksteal": |
| 114 | + return WorkStealingScheduling(config, log) |
| 115 | + return None |
111 | 116 |
|
112 | 117 | @pytest.hookimpl
|
113 | 118 | def pytest_runtestloop(self):
|
|
0 commit comments