Skip to content

Commit

Permalink
skip slow tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesBuchner committed May 26, 2024
1 parent 1b6a887 commit 6da81d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ jobs:
run: python -m pip install -e .

- name: Test with pytest
run: pytest
run: pytest -v -k 'not SLOW'
11 changes: 5 additions & 6 deletions tests/test_popstepsampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,7 @@ def test_update_slice_sampler():

# aim at checking the sanity of the results of
# one iteration of the slice sampler.
def Test_SimpleSliceSampler(seed):

def test_SimpleSliceSampler_SLOW(seed=4):
np.random.seed(seed)
nsteps = 1
popsize = 100
Expand Down Expand Up @@ -245,21 +244,21 @@ def Test_SimpleSliceSampler(seed):
# resetting the seed to check the slice axes
np.random.seed(seed)
for i in range(popsize):
u[i],_,L[i],_= stepsampler.__next__(region,Lmin,us.copy(),Ls.copy(),transform,loglike_vectorized,test=True)
u[i],_,L[i],_= stepsampler.__next__(region, Lmin, us.copy(), Ls.copy(), transform, loglike_vectorized, test=True)

# Basic check
assert (L>Lmin).all(), (L,Lmin) # Lmin check
assert (u>0).all() and (u<1).all(), u # u in the unit cube check

np.random.seed(seed)
# resetting the random generation inside the sampler
_=np.random.randint(0, us.shape[0], size=stepsampler.popsize)
_=stepsampler.scale_jitter_func()
np.random.randint(0, us.shape[0], size=stepsampler.popsize)
stepsampler.scale_jitter_func()

# Getting the slice axes
slice_axes = stepsampler.generate_direction(us.copy(), region,scale= 1.0)
for i in range(popsize):
v=(u[i,:]-us[i,:])/slice_axes[i,:]
v = (u[i,:] - us[i,:]) / slice_axes[i, :]
mean_v = np.mean(v)
assert np.allclose(mean_v, v, atol=1e-10), (mean_v, v)

Expand Down

0 comments on commit 6da81d8

Please sign in to comment.