def pytest_generate_tests(metafunc): if hasattr(metafunc.function, "full"): theta = sorted(range(0, 360, 45) + [39]) flipped = [True, False] elif hasattr(metafunc.function, "once"): theta = [0] flipped = [False] elif hasattr(metafunc.function, "smallrot"): theta = [20, 340] flipped = [True, False] else: theta = [39] flipped = [True, False] all_argnames = ['theta', 'flipped', 'Xa', 'Xb', 'model'] argnames = [x for x in metafunc.fixturenames if x in all_argnames] if len(argnames) == 0: return argvalues = [] for t, f in product(theta, flipped): # create stimulus X = Stimulus2D.random(8) if f: X.flip([0, 1]) X.rotate(t) Xa = X.copy_from_initial() Xb = X.copy_from_vertices() # create model model = metafunc.cls.cls( Xa.vertices, Xb.vertices, S_sigma=S_sigma, step=step, prior=prior) args = dict(theta=t, flipped=f, Xa=Xa, Xb=Xb, model=model) argvalues.append([args[x] for x in argnames]) metafunc.parametrize(argnames, argvalues)
def X0(): X = Stimulus2D.random(8) return X