(monkeypatch)
| 82 | |
| 83 | @pytest.fixture |
| 84 | def monkeypatch_cpu_count(monkeypatch): |
| 85 | def cpu_count(): |
| 86 | return 250 # Absurdly high, unlikely to match real value |
| 87 | |
| 88 | def sched_getaffinity(pid): |
| 89 | return set(range(250)) |
| 90 | |
| 91 | class Process: |
| 92 | def cpu_affinity(self): |
| 93 | return list(range(250)) |
| 94 | |
| 95 | monkeypatch.setattr(os, "cpu_count", cpu_count) |
| 96 | if sys.version_info >= (3, 13): |
| 97 | monkeypatch.setattr(os, "process_cpu_count", cpu_count) |
| 98 | monkeypatch.setattr(os, "sched_getaffinity", sched_getaffinity) |
| 99 | with suppress(ImportError): |
| 100 | import psutil |
| 101 | |
| 102 | monkeypatch.setattr(psutil, "Process", Process) |
| 103 | |
| 104 | |
| 105 | @pytest.mark.skipif(not LINUX, reason="Control Groups only available on Linux") |
nothing calls this directly
no outgoing calls
no test coverage detected