Skip to content

Commit e063c58

Browse files
authored
tests: add pytest testmon plugin to speed up CI (#1402)
* add pytest testmon plugin * test changes to check testmon * allow testmon and markers * further improvements for uv and testmon * add test comment * fix caching, test changes in mcmc posterior * fix uv setup * fix uv setup * fix uv setup * fix uv setup * another fix * remove pip from ci * undo changes to test testmon * load testmon cache first * restore old testmon setup * reorder jobs * test comment * back to uv pip * test change * seems to be working 🎉
1 parent 49e091f commit e063c58

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,24 @@ jobs:
4040
uv pip install torch --extra-index-url https://download.pytorch.org/whl/cpu
4141
uv pip install -e .[dev]
4242
43+
- name: Cache uv dependencies
44+
uses: actions/cache@v4
45+
with:
46+
path: ~/.cache/uv
47+
key: uv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
48+
restore-keys: |
49+
uv-${{ runner.os }}-${{ matrix.python-version }}-
50+
51+
- name: Cache testmon data
52+
uses: actions/cache@v4
53+
with:
54+
path: .testmondata
55+
key: testmon-${{ runner.os }}-${{ matrix.python-version }}-${{ github.ref }}
56+
restore-keys: |
57+
testmon-${{ runner.os }}-${{ matrix.python-version }}-
58+
4359
- name: Run the fast CPU tests with coverage
44-
run: |
45-
uv run pytest -v -x -n auto -m "not slow and not gpu" --cov=sbi --cov-report=xml tests/
60+
run: uv run pytest --testmon-forceselect -v -n auto -m "not slow and not gpu" --cov=sbi --cov-report=xml tests/
4661

4762
- name: Upload coverage to Codecov
4863
uses: codecov/codecov-action@v4

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ dev = [
7171
# Test
7272
"pytest",
7373
"pytest-cov",
74+
"pytest-testmon",
7475
"pytest-xdist",
7576
"torchtestcase",
7677
]

sbi/neural_nets/net_builders/mnle.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ def build_mnle(
166166

167167
# Set up a flow for modelling the continuous data, conditioned on the discrete data.
168168
continuous_net = model_builders[flow_model](
169-
# TODO: add support for optional log-transform in flow builders.
170169
batch_x=(
171170
torch.log(cont_x) if log_transform_x else cont_x
172171
), # log transform manually.

0 commit comments

Comments
 (0)