Skip to content

Commit 17ece6d

Browse files
committed
clean up fixture definitions of inference and summary networks
1 parent b8d870f commit 17ece6d

File tree

3 files changed

+10
-27
lines changed

3 files changed

+10
-27
lines changed

tests/conftest.py

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,9 @@ def conditions_size(request):
3232
return request.param
3333

3434

35-
@pytest.fixture(scope="function")
36-
def coupling_flow():
37-
from bayesflow.networks import CouplingFlow
38-
39-
return CouplingFlow(depth=2, subnet="mlp", subnet_kwargs=dict(widths=(32, 32)))
35+
@pytest.fixture(params=[1, 4], scope="session")
36+
def summary_dim(request):
37+
return request.param
4038

4139

4240
@pytest.fixture(params=["two_moons"], scope="session")
@@ -49,16 +47,6 @@ def feature_size(request):
4947
return request.param
5048

5149

52-
@pytest.fixture(params=["coupling_flow"], scope="function")
53-
def inference_network(request):
54-
return request.getfixturevalue(request.param)
55-
56-
57-
@pytest.fixture(params=["inference_network", "summary_network"], scope="function")
58-
def network(request):
59-
return request.getfixturevalue(request.param)
60-
61-
6250
@pytest.fixture(scope="session")
6351
def random_conditions(batch_size, conditions_size):
6452
if conditions_size is None:
@@ -94,13 +82,6 @@ def simulator(request):
9482
return request.getfixturevalue(request.param)
9583

9684

97-
@pytest.fixture(params=[None], scope="function")
98-
def summary_network(request, summary_dim):
99-
if request.param is None:
100-
return None
101-
return request.getfixturevalue(request.param)
102-
103-
10485
@pytest.fixture(scope="session")
10586
def training_dataset(simulator, batch_size):
10687
from bayesflow.datasets import OfflineDataset

tests/test_networks/conftest.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import pytest
22

33

4-
@pytest.fixture(params=[1, 4], scope="session")
5-
def summary_dim(request):
6-
return request.param
7-
8-
94
# For the serialization tests, we want to test passing str and type.
105
# For all other tests, this is not necessary and would double test time.
116
# Therefore, below we specify two variants of each network, one without and

tests/test_two_moons/conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
import pytest
22

33

4+
@pytest.fixture()
5+
def inference_network():
6+
from bayesflow.networks import CouplingFlow
7+
8+
return CouplingFlow(depth=2, subnet="mlp", subnet_kwargs=dict(widths=(32, 32)))
9+
10+
411
@pytest.fixture()
512
def approximator(adapter, inference_network):
613
from bayesflow import ContinuousApproximator

0 commit comments

Comments
 (0)