Skip to content

Commit c638124

Browse files
authored
remove multiple batch sizes, remove multiple python version tests, remove update-workflows branch from workflow style tests, add __init__ and conftest to test_point_approximators (#443)
1 parent 3b1c053 commit c638124

File tree

9 files changed

+7
-44
lines changed

9 files changed

+7
-44
lines changed

.github/workflows/style.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ on:
66
branches:
77
- main
88
- dev
9-
- update-workflows
109
push:
1110
branches:
1211
- main
1312
- dev
14-
- update-workflows
1513

1614
jobs:
1715
check-code-style:

.github/workflows/tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
strategy:
2525
matrix:
2626
os: [ubuntu-latest, windows-latest]
27-
python-version: ["3.10", "3.11"]
27+
python-version: ["3.10"] # we usually only need to test the oldest python version
2828
backend: ["jax", "tensorflow", "torch"]
2929

3030
runs-on: ${{ matrix.os }}

tests/conftest.py

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def pytest_make_parametrize_id(config, val, argname):
4141
return f"{argname}={repr(val)}"
4242

4343

44-
@pytest.fixture(params=[2, 3], scope="session")
44+
@pytest.fixture(params=[2], scope="session")
4545
def batch_size(request):
4646
return request.param
4747

@@ -94,33 +94,3 @@ def random_set(batch_size, set_size, feature_size):
9494
@pytest.fixture(params=[2, 3], scope="session")
9595
def set_size(request):
9696
return request.param
97-
98-
99-
@pytest.fixture(params=["two_moons"], scope="session")
100-
def simulator(request):
101-
return request.getfixturevalue(request.param)
102-
103-
104-
@pytest.fixture(scope="session")
105-
def training_dataset(simulator, batch_size):
106-
from bayesflow.datasets import OfflineDataset
107-
108-
num_batches = 128
109-
samples = simulator.sample((num_batches * batch_size,))
110-
return OfflineDataset(samples, batch_size=batch_size)
111-
112-
113-
@pytest.fixture(scope="session")
114-
def two_moons(batch_size):
115-
from bayesflow.simulators import TwoMoonsSimulator
116-
117-
return TwoMoonsSimulator()
118-
119-
120-
@pytest.fixture(scope="session")
121-
def validation_dataset(simulator, batch_size):
122-
from bayesflow.datasets import OfflineDataset
123-
124-
num_batches = 16
125-
samples = simulator.sample((num_batches * batch_size,))
126-
return OfflineDataset(samples, batch_size=batch_size)

tests/test_approximators/test_point_approximators/__init__.py

Whitespace-only changes.

tests/test_approximators/test_point_approximators/conftest.py

Whitespace-only changes.

tests/test_distributions/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import keras
44

55

6-
@pytest.fixture(params=[2, 3])
6+
@pytest.fixture(params=[2])
77
def batch_size(request):
88
return request.param
99

tests/test_links/conftest.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,3 @@ def quantiles(request):
8282
@pytest.fixture()
8383
def unordered(batch_size, num_quantiles, num_variables):
8484
return keras.random.normal((batch_size, num_quantiles, num_variables))
85-
86-
87-
# @pytest.fixture()
88-
# def random_matrix_batch(batch_size, num_variables):
89-
# return keras.random.normal((batch_size, num_variables, num_variables))

tests/test_networks/test_summary_networks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def test_save_and_load(tmp_path, summary_network, random_set):
103103
@pytest.mark.parametrize("stage", ["training", "validation"])
104104
def test_compute_metrics(stage, summary_network, random_set):
105105
if summary_network is None:
106-
pytest.skip()
106+
pytest.skip("Nothing to do, because there is no summary network.")
107107

108108
summary_network.build(keras.ops.shape(random_set))
109109

tests/utils/check_combinations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ def check_combination_simulator_adapter(simulator, adapter):
1313
with pytest.raises(KeyError):
1414
adapter(simulator.sample(1))
1515
# Don't use this fixture combination for further tests.
16-
pytest.skip()
16+
pytest.skip(reason="Do not use this fixture combination for further tests") # TODO: better reason
1717
elif simulator_with_sample_weight and not adapter_with_sample_weight:
1818
# When a weight key is present, but the adapter does not configure it
1919
# to be used as sample weight, no error is raised currently.
2020
# Don't use this fixture combination for further tests.
21-
pytest.skip()
21+
pytest.skip(reason="Do not use this fixture combination for further tests") # TODO: better reason
2222

2323

2424
def check_approximator_multivariate_normal_score(approximator):
@@ -28,4 +28,4 @@ def check_approximator_multivariate_normal_score(approximator):
2828
if isinstance(approximator, PointApproximator):
2929
for score in approximator.inference_network.scores.values():
3030
if isinstance(score, MultivariateNormalScore):
31-
pytest.skip()
31+
pytest.skip(reason="MultivariateNormalScore is unstable")

0 commit comments

Comments
 (0)