fix test_sampling
@@ -8,8 +8,11 @@ from gammapy.utils.testing import requires_dependency, requires_data
@pytest.fixture(scope="session")
def dataset():
- dataset = Datasets.read("$GAMMAPY_DATA/fermi-3fhl-crab/Fermi-LAT-3FHL_datasets.yaml",
- "$GAMMAPY_DATA/fermi-3fhl-crab/Fermi-LAT-3FHL_models.yaml")
+ dataset = Datasets.read(
+ "$GAMMAPY_DATA/fermi-3fhl-crab/",
+ "Fermi-LAT-3FHL_datasets.yaml",
+ "Fermi-LAT-3FHL_models.yaml",
+ )
# Define the free parameters and min, max values
parameters = dataset.models.parameters
@@ -27,6 +30,7 @@ def dataset():
return dataset
+
@requires_data()
def test_lnprob(dataset):
# Testing priors and parameter bounds
@@ -38,6 +42,7 @@ def test_lnprob(dataset):
parameters["amplitude"].value = 1000
assert ln_uniform_prior(dataset) == -np.inf
+
@requires_dependency("emcee")
@requires_data()
def test_runmcmc(dataset):
@@ -46,4 +51,3 @@ def test_runmcmc(dataset):
sampler = run_mcmc(dataset, nwalkers=6, nrun=10) # to speedup the test
assert isinstance(sampler, emcee.ensemble.EnsembleSampler)
-
