Commit dcc04ef
Arm backend: Make pytest collection seeding deterministic (pytorch#20621)
### Summary
Seed the Arm test RNG during pytest configuration in OSS/local test runs
so module-level random inputs are deterministic before collection
imports test modules.
This will make tests behave less random and hopefully fix some flakeynes
in testing/CI.
For example test_dl3_arm.py failes about 5% of the time before this fix
due to it getting non seeded random numbers.
Extra cleanup/fixes:
Use TEST_SEED for the Arm test session seed, replacing the old
ARM_TEST_SEED environment variable name.
Keep packaged non-OSS Buck behavior unchanged by skipping that early
torch import there, while preserving the per-test seeding fixture.
### Test plan
This is tested by all Arm backend pytests
Signed-off-by: Zingo Andersen <Zingo.Andersen@arm.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>1 parent 8f1abad commit dcc04ef
2 files changed
Lines changed: 48 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
29 | 42 | | |
30 | 43 | | |
31 | 44 | | |
| |||
63 | 76 | | |
64 | 77 | | |
65 | 78 | | |
66 | | - | |
| 79 | + | |
67 | 80 | | |
68 | 81 | | |
69 | | - | |
70 | | - | |
| 82 | + | |
| 83 | + | |
71 | 84 | | |
72 | 85 | | |
73 | 86 | | |
74 | 87 | | |
75 | | - | |
76 | | - | |
| 88 | + | |
| 89 | + | |
77 | 90 | | |
78 | | - | |
| 91 | + | |
79 | 92 | | |
80 | 93 | | |
81 | | - | |
| 94 | + | |
| 95 | + | |
82 | 96 | | |
83 | | - | |
| 97 | + | |
| 98 | + | |
84 | 99 | | |
85 | 100 | | |
86 | 101 | | |
87 | | - | |
| 102 | + | |
88 | 103 | | |
89 | 104 | | |
90 | | - | |
91 | | - | |
| 105 | + | |
92 | 106 | | |
93 | | - | |
94 | | - | |
95 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
96 | 114 | | |
97 | | - | |
| 115 | + | |
| 116 | + | |
98 | 117 | | |
99 | 118 | | |
100 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
99 | 112 | | |
100 | 113 | | |
101 | 114 | | |
| |||
105 | 118 | | |
106 | 119 | | |
107 | 120 | | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
| 121 | + | |
117 | 122 | | |
118 | 123 | | |
119 | 124 | | |
| |||
0 commit comments