Skip to content
Snippets Groups Projects
Commit 6759ce39 authored by Colm Talbot's avatar Colm Talbot
Browse files

Test that samplers import in CI

parent 7ee82430
No related branches found
No related tags found
1 merge request!1045Test that samplers import in CI
......@@ -71,6 +71,25 @@ basic-3.10:
<<: *test-python
image: python:3.10
.test-samplers-import: &test-samplers-import
stage: initial
script:
- python -m pip install .
- python -m pip list installed
- python test/test_samplers_import.py
import-samplers-3.8:
<<: *test-samplers-import
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python38
import-samplers-3.9:
<<: *test-samplers-import
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python39
import-samplers-3.10:
<<: *test-samplers-import
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python310
.precommits: &precommits
stage: initial
script:
......
"""
Tests the number of packages imported with a top-level :code:`import bilby`
statement.
"""
import sys
import bilby # noqa
......
"""
Tests that all of the implemented samplers can be initialized.
The :code:`FakeSampler` is omitted as that doesn't require importing
any package.
"""
import bilby
bilby.core.utils.logger.setLevel("ERROR")
IMPLEMENTED_SAMPLERS = bilby.core.sampler.IMPLEMENTED_SAMPLERS
likelihood = bilby.core.likelihood.Likelihood(dict())
priors = bilby.core.prior.PriorDict(dict(a=bilby.core.prior.Uniform(0, 1)))
for sampler in IMPLEMENTED_SAMPLERS:
if sampler == "fake_sampler":
continue
sampler_class = IMPLEMENTED_SAMPLERS[sampler]
sampler = sampler_class(likelihood=likelihood, priors=priors)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment