Skip to content

Commit b895e40

Browse files
Fix Windows jobs & redistribute to reduce runtime
Closes #5475
1 parent e0a0325 commit b895e40

File tree

3 files changed

+47
-78
lines changed

3 files changed

+47
-78
lines changed

Diff for: .github/workflows/tests.yml

+26-73
Original file line numberDiff line numberDiff line change
@@ -35,74 +35,45 @@ jobs:
3535
os: [ubuntu-20.04]
3636
floatx: [float32, float64]
3737
test-subset:
38-
# How this works:
39-
# 1st block: Only passes --ignore parameters to pytest.
40-
# → pytest will run all test_*.py files that are NOT ignored.
41-
#
42-
# Subsequent blocks: Only pass paths to test files.
43-
# → pytest will run only these files
4438
- |
45-
--ignore=pymc/tests/test_distributions_timeseries.py
46-
--ignore=pymc/tests/test_mixture.py
47-
--ignore=pymc/tests/test_model_graph.py
48-
--ignore=pymc/tests/test_modelcontext.py
49-
--ignore=pymc/tests/test_parallel_sampling.py
50-
--ignore=pymc/tests/test_posteriors.py
51-
--ignore=pymc/tests/test_sampling.py
52-
--ignore=pymc/tests/test_profile.py
53-
--ignore=pymc/tests/test_step.py
54-
--ignore=pymc/tests/test_tuning.py
55-
--ignore=pymc/tests/test_transforms.py
56-
--ignore=pymc/tests/test_sampling_jax.py
57-
--ignore=pymc/tests/test_dist_math.py
58-
--ignore=pymc/tests/test_minibatches.py
59-
--ignore=pymc/tests/test_pickling.py
60-
--ignore=pymc/tests/test_updates.py
61-
--ignore=pymc/tests/test_gp.py
62-
--ignore=pymc/tests/test_model.py
63-
--ignore=pymc/tests/test_ode.py
64-
--ignore=pymc/tests/test_posdef_sym.py
65-
--ignore=pymc/tests/test_quadpotential.py
66-
--ignore=pymc/tests/test_shape_handling.py
67-
--ignore=pymc/tests/test_distributions.py
68-
--ignore=pymc/tests/test_distributions_random.py
69-
--ignore=pymc/tests/test_idata_conversion.py
70-
--ignore=pymc/tests/test_smc.py
71-
--ignore=pymc/tests/test_missing.py
39+
pymc/tests/test_util.py
40+
pymc/tests/test_logprob.py
41+
pymc/tests/test_aesaraf.py
42+
pymc/tests/test_math.py
43+
pymc/tests/test_posdef_sym.py
44+
pymc/tests/test_ndarray_backend.py
45+
pymc/tests/test_hmc.py
46+
pymc/tests/test_func_utils.py
47+
pymc/tests/test_shape_handling.py
48+
pymc/tests/test_starting.py
49+
pymc/tests/test_mixture.py
7250
7351
- |
7452
pymc/tests/test_distributions.py
7553
54+
- |
55+
pymc/tests/test_tuning.py
56+
pymc/tests/test_shared.py
57+
pymc/tests/test_types.py
58+
pymc/tests/test_distributions_moments.py
59+
7660
- |
7761
pymc/tests/test_modelcontext.py
7862
pymc/tests/test_dist_math.py
7963
pymc/tests/test_minibatches.py
8064
pymc/tests/test_pickling.py
81-
pymc/tests/test_updates.py
8265
pymc/tests/test_transforms.py
83-
pymc/tests/test_smc.py
84-
pymc/tests/test_mixture.py
85-
86-
- |
8766
pymc/tests/test_parallel_sampling.py
88-
pymc/tests/test_sampling.py
89-
pymc/tests/test_tuning.py
90-
pymc/tests/test_posteriors.py
91-
pymc/tests/test_step.py
9267
9368
- |
94-
pymc/tests/test_idata_conversion.py
9569
pymc/tests/test_distributions_random.py
9670
pymc/tests/test_distributions_timeseries.py
9771
pymc/tests/test_gp.py
9872
pymc/tests/test_model.py
9973
pymc/tests/test_model_graph.py
10074
pymc/tests/test_ode.py
101-
pymc/tests/test_posdef_sym.py
10275
pymc/tests/test_profile.py
10376
pymc/tests/test_quadpotential.py
104-
pymc/tests/test_shape_handling.py
105-
pymc/tests/test_missing.py
10677
10778
fail-fast: false
10879
runs-on: ${{ matrix.os }}
@@ -167,27 +138,10 @@ jobs:
167138
os: [windows-latest]
168139
floatx: [float32, float64]
169140
test-subset:
170-
- |
171-
pymc/tests/test_initial_point.py
172-
pymc/tests/test_distributions_random.py
173-
pymc/tests/test_distributions_moments.py
174-
pymc/tests/test_distributions_timeseries.py
175-
pymc/tests/test_variational_inference.py
176-
- |
177-
pymc/tests/test_parallel_sampling.py
178-
pymc/tests/test_sampling.py
179-
pymc/tests/test_tuning.py
180-
pymc/tests/test_shared.py
181-
pymc/tests/test_types.py
182-
- |
183-
pymc/tests/test_gp.py
184-
pymc/tests/test_ode.py
185-
- |
186-
pymc/tests/test_model.py
187-
pymc/tests/test_modelcontext.py
188-
pymc/tests/test_model_graph.py
189-
pymc/tests/test_pickling.py
190-
pymc/tests/test_profile.py
141+
- pymc/tests/test_variational_inference.py pymc/tests/test_initial_point.py
142+
- pymc/tests/test_pickling.py pymc/tests/test_profile.py pymc/tests/test_step.py
143+
- pymc/tests/test_gp.py pymc/tests/test_ode.py pymc/tests/test_smc.py pymc/tests/test_parallel_sampling.py
144+
- pymc/tests/test_sampling.py pymc/tests/test_posteriors.py
191145

192146
fail-fast: false
193147
runs-on: ${{ matrix.os }}
@@ -256,16 +210,15 @@ jobs:
256210
test-subset:
257211
- |
258212
pymc/tests/test_parallel_sampling.py
259-
pymc/tests/test_posteriors.py
213+
pymc/tests/test_data_container.py
214+
pymc/tests/test_missing.py
215+
216+
- |
260217
pymc/tests/test_sampling.py
261218
262219
- |
263-
pymc/tests/test_data_container.py
264220
pymc/tests/test_idata_conversion.py
265-
pymc/tests/test_missing.py
266-
pymc/tests/test_model.py
267-
pymc/tests/test_shape_handling.py
268-
pymc/tests/test_shared.py
221+
pymc/tests/test_updates.py
269222
fail-fast: false
270223
runs-on: ${{ matrix.os }}
271224
env:

Diff for: pymc/tests/test_ode.py

-4
Original file line numberDiff line numberDiff line change
@@ -238,30 +238,26 @@ def system(y, t, p):
238238
func=system, t0=0, times=self.times, n_states=1, n_theta=1
239239
)
240240

241-
@pytest.mark.xfail(condition=(IS_FLOAT32 and IS_WINDOWS), reason="Fails on float32 on Windows")
242241
def test_too_many_params(self):
243242
with pytest.raises(
244243
pm.ShapeError,
245244
match="Length of theta is wrong. \\(actual \\(2,\\) != expected \\(1,\\)\\)",
246245
):
247246
self.ode_model(theta=[1, 1], y0=[0])
248247

249-
@pytest.mark.xfail(condition=(IS_FLOAT32 and IS_WINDOWS), reason="Fails on float32 on Windows")
250248
def test_too_many_y0(self):
251249
with pytest.raises(
252250
pm.ShapeError, match="Length of y0 is wrong. \\(actual \\(2,\\) != expected \\(1,\\)\\)"
253251
):
254252
self.ode_model(theta=[1], y0=[0, 0])
255253

256-
@pytest.mark.xfail(condition=(IS_FLOAT32 and IS_WINDOWS), reason="Fails on float32 on Windows")
257254
def test_too_few_params(self):
258255
with pytest.raises(
259256
pm.ShapeError,
260257
match="Length of theta is wrong. \\(actual \\(0,\\) != expected \\(1,\\)\\)",
261258
):
262259
self.ode_model(theta=[], y0=[1])
263260

264-
@pytest.mark.xfail(condition=(IS_FLOAT32 and IS_WINDOWS), reason="Fails on float32 on Windows")
265261
def test_too_few_y0(self):
266262
with pytest.raises(
267263
pm.ShapeError, match="Length of y0 is wrong. \\(actual \\(0,\\) != expected \\(1,\\)\\)"

Diff for: scripts/check_all_tests_are_covered.py

+21-1
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,29 @@ def from_yaml():
6969
for os_, floatX, subset in itertools.product(
7070
matrix["os"], matrix["floatx"], matrix["test-subset"]
7171
):
72-
testfiles = subset.split("\n")
72+
lines = [l for l in subset.split("\n") if l]
73+
if "windows" in os_:
74+
# Windows jobs need \ in line breaks within the test-subset!
75+
# The following checks that these trailing \ are present in
76+
# all items except the last.
77+
nlines = len(lines)
78+
for l, line in enumerate(lines):
79+
if l < nlines - 1 and not line.endswith(" \\"):
80+
raise Exception(f"Missing ' \\' after '{line}' in Windows test-subset.")
81+
elif l == nlines - 1 and line.endswith(" \\"):
82+
raise Exception(
83+
f"Last entry '{line}' in Windows test subset should end WITHOUT ' \\'."
84+
)
85+
testfiles[l] = line.strip(" \\")
86+
87+
# Unpack lines with >1 item
88+
testfiles = []
89+
for line in lines:
90+
testfiles += line.split(" ")
91+
7392
ignored = {item.strip("--ignore=") for item in testfiles if item.startswith("--ignore")}
7493
included = {item for item in testfiles if item and not item.startswith("--ignore")}
94+
7595
if ignored and not included:
7696
# if no testfile is specified explicitly pytest runs all except the ignored ones
7797
included = all_tests - ignored

0 commit comments

Comments
 (0)