diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9b39700a97b97cf990846094ad00b33d9c483e05..c7933b7681060dfd53efaf203647b2a52f195956 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,6 +12,7 @@ stages: - initial - test + - docs - deploy .test-python: &test-python @@ -47,6 +48,8 @@ python-3.7: image: quay.io/bilbydev/v2-dockerfile-test-suite-python37 script: - python -m pip install . + # temporary fix for broken astropy version + - pip install pyerfa==1.7.1.1 # Run pyflakes - flake8 . @@ -62,12 +65,14 @@ python-3.7: - htmlcov/ docs: - stage: initial + stage: docs image: quay.io/bilbydev/v2-dockerfile-test-suite-python37 script: # Make the documentation - apt-get -yqq install pandoc - python -m pip install . + # temporary fix for broken astropy version + - pip install pyerfa==1.7.1.1 - cd docs - pip install ipykernel ipython jupyter - cp ../examples/tutorials/*.ipynb ./ @@ -88,6 +93,8 @@ python-3.8: image: quay.io/bilbydev/v2-dockerfile-test-suite-python38 script: - python -m pip install . + # temporary fix for broken astropy version + - pip install pyerfa==1.7.1.1 - pytest @@ -97,6 +104,8 @@ python-3.6: image: quay.io/bilbydev/v2-dockerfile-test-suite-python36 script: - python -m pip install . + # temporary fix for broken astropy version + - pip install pyerfa==1.7.1.1 - pytest @@ -106,6 +115,8 @@ python-3.7-samplers: image: quay.io/bilbydev/v2-dockerfile-test-suite-python37 script: - python -m pip install . + # temporary fix for broken astropy version + - pip install pyerfa==1.7.1.1 - pytest test/integration/sampler_run_test.py --durations 10 - pytest test/integration/sample_from_the_prior_test.py @@ -116,6 +127,8 @@ python-3.6-samplers: image: quay.io/bilbydev/v2-dockerfile-test-suite-python36 script: - python -m pip install . + # temporary fix for broken astropy version + - pip install pyerfa==1.7.1.1 - pytest test/integration/sampler_run_test.py @@ -138,6 +151,8 @@ scheduled-python-3.7: - schedules script: - python -m pip install . + # temporary fix for broken astropy version + - pip install pyerfa==1.7.1.1 # Run tests which are only done on schedule - pytest test/integration/example_test.py diff --git a/test/check_author_list.py b/test/check_author_list.py index 1b082e219da9e6105185cd47f0a9bd3b03e4287d..c43f0f0030d657148ec5991faf807bac6b4192ca 100644 --- a/test/check_author_list.py +++ b/test/check_author_list.py @@ -21,7 +21,7 @@ for line in lines: for element in line.split()[1:]: element = element.lower() if element not in AUTHORS_list and element not in special_cases: - print("Failure: {} not in AUTHOR.md".format(element)) + print(f"Failure: {element} not in AUTHOR.md") fail_test += True if fail_test: diff --git a/test/core/sampler/pymc3_test.py b/test/core/sampler/pymc3_test.py index d8a28ad48b13d70e0c712ecc9066b5c2804fd0a0..ad1df20f4a077038c2046e260c26880ec1737aec 100644 --- a/test/core/sampler/pymc3_test.py +++ b/test/core/sampler/pymc3_test.py @@ -1,10 +1,13 @@ import unittest +import pytest +import sys from mock import MagicMock import bilby +@pytest.mark.skipif(sys.version_info[1] <= 6, reason="pymc3 is broken in py36") class TestPyMC3(unittest.TestCase): def setUp(self): self.likelihood = MagicMock() diff --git a/test/integration/sampler_run_test.py b/test/integration/sampler_run_test.py index 3278ddc0f1f0b70f0ebb42e7e9e617d367c9777f..d5315cd00ba25db25f0904ecd0f89404fa1bed7a 100644 --- a/test/integration/sampler_run_test.py +++ b/test/integration/sampler_run_test.py @@ -1,7 +1,10 @@ -import bilby import unittest -import numpy as np +import pytest import shutil +import sys + +import bilby +import numpy as np class TestRunningSamplers(unittest.TestCase): @@ -103,6 +106,7 @@ class TestRunningSamplers(unittest.TestCase): ) def test_run_pypolychord(self): + pytest.importorskip("pypolychord") _ = bilby.run_sampler( likelihood=self.likelihood, priors=self.priors, @@ -124,6 +128,7 @@ class TestRunningSamplers(unittest.TestCase): save=False, ) + @pytest.mark.skipif(sys.version_info[1] <= 6, reason="pymc3 is broken in py36") def test_run_pymc3(self): _ = bilby.run_sampler( likelihood=self.likelihood,