diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d3b5a4ce731ae10b1b541867272a3fecd6b99e52..84a6aafd30795df58bfe017ece4d14403dbaecf6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,14 +20,14 @@ stages: # Check author list is up to date authors: stage: initial - image: containers.ligo.org/lscsoft/bilby/v2-bilby-python37 + image: containers.ligo.org/lscsoft/bilby/v2-bilby-python39 script: - python test/check_author_list.py # Test containers scripts are up to date containers: stage: initial - image: containers.ligo.org/lscsoft/bilby/v2-bilby-python37 + image: containers.ligo.org/lscsoft/bilby/v2-bilby-python39 script: - cd containers - python write_dockerfiles.py #HACK @@ -63,143 +63,116 @@ containers: ${script} --help; done -# Test basic setup on python 3.7 -basic-3.7: - <<: *test-python - image: python:3.7 - -# Test basic setup on python 3.8 basic-3.8: <<: *test-python image: python:3.8 -# Test basic setup on python 3.9 basic-3.9: <<: *test-python image: python:3.9 +basic-3.10: + <<: *test-python + image: python:3.10 -precommits-py3.7: +.precommits: &precommits stage: initial - image: containers.ligo.org/lscsoft/bilby/v2-bilby-python37 script: - - source activate python37 - - mkdir -p .pip37 + - source activate $PYVERSION + - mkdir -p $CACHE_DIR - pip install --upgrade pip - - pip --cache-dir=.pip37 install --upgrade bilby - - pip --cache-dir=.pip37 install . - - pip --cache-dir=.pip37 install pre-commit + - pip --cache-dir=$CACHE_DIR install --upgrade bilby + - pip --cache-dir=$CACHE_DIR install . + - pip --cache-dir=$CACHE_DIR install pre-commit # Run precommits (flake8, spellcheck, isort, no merge conflicts, etc) - pre-commit run --all-files --verbose --show-diff-on-failure precommits-py3.8: - stage: initial + <<: *precommits image: containers.ligo.org/lscsoft/bilby/v2-bilby-python38 - script: - - source activate python38 - - mkdir -p .pip38 - - pip install --upgrade pip - - pip --cache-dir=.pip38 install --upgrade bilby - - pip --cache-dir=.pip38 install . - - pip --cache-dir=.pip38 install pre-commit - # Run precommits (flake8, spellcheck, isort, no merge conflicts, etc) - - pre-commit run --all-files --verbose --show-diff-on-failure + variables: + CACHE_DIR: ".pip38" + PYVERSION: "python38" precommits-py3.9: - stage: initial + <<: *precommits image: containers.ligo.org/lscsoft/bilby/v2-bilby-python39 - script: - - source activate python39 - - mkdir -p .pip38 - - pip install --upgrade pip - - pip --cache-dir=.pip39 install --upgrade bilby - - pip --cache-dir=.pip39 install . - - pip --cache-dir=.pip39 install pre-commit - # Run precommits (flake8, spellcheck, isort, no merge conflicts, etc) - - pre-commit run --all-files --verbose --show-diff-on-failure + variables: + CACHE_DIR: ".pip39" + PYVERSION: "python39" + +# FIXME: when image builds for 3.10 change this back. +#precommits-py3.10: +# <<: *precommits +# image: containers.ligo.org/lscsoft/bilby/v2-bilby-python310 +# variables: +# CACHE_DIR: ".pip310" +# PYVERSION: "python310" # ------------------- Test stage ------------------------------------------- -# test example on python 3.7 and build coverage -python-3.7: +.unit-tests: &unit-test stage: test - needs: ["basic-3.7", "precommits-py3.7"] - image: containers.ligo.org/lscsoft/bilby/v2-bilby-python37 script: - python -m pip install . - python -m pip list installed - # Run pyflakes - - flake8 . - - # Run tests and collect coverage data - pytest --cov=bilby --durations 10 + +python-3.8: + <<: *unit-test + needs: ["basic-3.8", "precommits-py3.8"] + image: containers.ligo.org/lscsoft/bilby/v2-bilby-python38 + after_script: - coverage html + - coverage xml - coverage-badge -o coverage_badge.svg -f artifacts: + reports: + cobertura: coverage.xml paths: - - coverage_badge.svg - htmlcov/ -# test example on python 3.8 -python-3.8: - stage: test - needs: ["basic-3.8", "precommits-py3.8"] - image: containers.ligo.org/lscsoft/bilby/v2-bilby-python38 - script: - - python -m pip install . - - python -m pip list installed - - pytest - -# test example on python 3.9 python-3.9: - stage: test + <<: *unit-test needs: ["basic-3.9", "precommits-py3.9"] image: containers.ligo.org/lscsoft/bilby/v2-bilby-python39 - script: - - python -m pip install . - - python -m pip list installed - - pytest +# add back when 3.10 image is available +#python-3.10: +# <<: *unit-test +# needs: ["basic-3.10", "precommits-py3.10"] +# image: containers.ligo.org/lscsoft/bilby/v2-bilby-python310 -# test samplers on python 3.7 -python-3.7-samplers: +.test-sampler: &test-sampler stage: test - needs: ["basic-3.7", "precommits-py3.7"] - image: containers.ligo.org/lscsoft/bilby/v2-bilby-python37 script: - python -m pip install . - python -m pip list installed - pytest test/integration/sampler_run_test.py --durations 10 -# test samplers on python 3.8 python-3.8-samplers: - stage: test + <<: *test-sampler needs: ["basic-3.8", "precommits-py3.8"] image: containers.ligo.org/lscsoft/bilby/v2-bilby-python38 - script: - - python -m pip install . - - python -m pip list installed - - pytest test/integration/sampler_run_test.py --durations 10 - -# test samplers on python 3.9 python-3.9-samplers: - stage: test + <<: *test-sampler needs: ["basic-3.9", "precommits-py3.9"] image: containers.ligo.org/lscsoft/bilby/v2-bilby-python39 - script: - - python -m pip install . - - python -m pip list installed - - pytest test/integration/sampler_run_test.py --durations 10 +# add back when 3.10 image is available +#python-3.10-samplers: +# <<: *test-sampler +# needs: ["basic-3.10", "precommits-py3.10"] +# image: containers.ligo.org/lscsoft/bilby/v2-bilby-python310 -integration-tests-python-3.7: +integration-tests-python-3.9: stage: test - image: containers.ligo.org/lscsoft/bilby/v2-bilby-python37 - needs: ["basic-3.7", "precommits-py3.7"] + image: containers.ligo.org/lscsoft/bilby/v2-bilby-python39 + needs: ["basic-3.9", "precommits-py3.9"] only: - schedules script: @@ -208,38 +181,38 @@ integration-tests-python-3.7: # Run tests which are only done on schedule - pytest test/integration/example_test.py -plotting-python-3.7: +.plotting: &plotting stage: test - image: containers.ligo.org/lscsoft/bilby/v2-bilby-python37 - needs: ["basic-3.7", "precommits-py3.7"] only: - schedules script: - python -m pip install . - - python -m pip install "ligo.skymap>=0.5.3" - python -m pip list installed - pytest test/gw/plot_test.py +plotting-python-3.8: + <<: *plotting + image: containers.ligo.org/lscsoft/bilby/v2-bilby-python38 + needs: ["basic-3.8", "precommits-py3.8"] + plotting-python-3.9: - stage: test - image: containers.ligo.org/lscsoft/bilby/v2-bilby-python37 + <<: *plotting + image: containers.ligo.org/lscsoft/bilby/v2-bilby-python39 needs: ["basic-3.9", "precommits-py3.9"] - only: - - schedules - script: - - python -m pip install . - - python -m pip install "ligo.skymap>=0.5.3" - - python -m pip list installed - - pytest test/gw/plot_test.py +# add back when 3.10 image is available +#plotting-python-3.10: +# <<: *plotting +# image: containers.ligo.org/lscsoft/bilby/v2-bilby-python310 +# needs: ["basic-3.10", "precommits-py3.10"] # ------------------- Docs stage ------------------------------------------- docs: stage: docs - needs: ["python-3.7"] - image: containers.ligo.org/lscsoft/bilby/v2-bilby-python37 + needs: ["python-3.9"] + image: containers.ligo.org/lscsoft/bilby/v2-bilby-python39 script: # Make the documentation - apt-get -yqq install pandoc @@ -262,7 +235,7 @@ docs: deploy-docs: stage: deploy - needs: ["docs", "python-3.7"] + needs: ["docs"] script: - mkdir public/ - mv htmlcov/ public/ @@ -275,49 +248,38 @@ deploy-docs: only: - master -# Build the containers -build-python37-container: +.build-container: &build-container stage: deploy - image: docker:19.03.12 + image: docker:20.10.12 needs: ["containers"] only: - schedules script: - cd containers - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - - docker build --tag v3-bilby-python37 - < v3-dockerfile-test-suite-python37 - - docker image tag v3-bilby-python37 containers.ligo.org/lscsoft/bilby/v2-bilby-python37:latest - - docker image push containers.ligo.org/lscsoft/bilby/v2-bilby-python37:latest + - docker build --tag v3-bilby-$PYVERSION - < v3-dockerfile-test-suite-$PYVERSION + - docker image tag v3-bilby-$PYVERSION containers.ligo.org/lscsoft/bilby/v2-bilby-$PYVERSION:latest + - docker image push containers.ligo.org/lscsoft/bilby/v2-bilby-$PYVERSION:latest build-python38-container: - stage: deploy - image: docker:19.03.12 - needs: ["containers"] - only: - - schedules - script: - - cd containers - - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - - docker build --tag v3-bilby-python38 - < v3-dockerfile-test-suite-python38 - - docker image tag v3-bilby-python38 containers.ligo.org/lscsoft/bilby/v2-bilby-python38:latest - - docker image push containers.ligo.org/lscsoft/bilby/v2-bilby-python38:latest + <<: *build-container + variables: + PYVERSION: "python38" build-python39-container: - stage: deploy - image: docker:19.03.12 - needs: ["containers"] - only: - - schedules - script: - - cd containers - - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - - docker build --tag v3-bilby-python39 - < v3-dockerfile-test-suite-python39 - - docker image tag v3-bilby-python39 containers.ligo.org/lscsoft/bilby/v2-bilby-python39:latest - - docker image push containers.ligo.org/lscsoft/bilby/v2-bilby-python39:latest + <<: *build-container + variables: + PYVERSION: "python39" + +# add back when 3.10 image is available +#build-python310-container: +# <<: *build-container +# variables: +# PYVERSION: "python310" pypi-release: stage: deploy - image: containers.ligo.org/lscsoft/bilby/v2-bilby-python37 + image: containers.ligo.org/lscsoft/bilby/v2-bilby-python39 variables: TWINE_USERNAME: $PYPI_USERNAME TWINE_PASSWORD: $PYPI_PASSWORD diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4fbe59bff671cb3282484c2440df766876be3cc1..b27fd416081c9f5f4826dfeaf49eb1f1be5e3ab0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,13 +5,13 @@ repos: - id: check-merge-conflict # prevent committing files with merge conflicts - id: flake8 # checks for flake8 errors - repo: https://github.com/psf/black - rev: 20.8b1 + rev: 21.12b0 hooks: - id: black language_version: python3 files: ^bilby/bilby_mcmc/ - repo: https://github.com/codespell-project/codespell - rev: v1.16.0 + rev: v2.1.0 hooks: - id: codespell args: [--ignore-words=.dictionary.txt] diff --git a/bilby/bilby_mcmc/chain.py b/bilby/bilby_mcmc/chain.py index 358265e2cf26f798f996ba3b966fb2ef5371ae59..8969d353623bd9570c30ca0829570dbc16f793e9 100644 --- a/bilby/bilby_mcmc/chain.py +++ b/bilby/bilby_mcmc/chain.py @@ -253,7 +253,7 @@ class Chain(object): @property def tau(self): - """ The maximum ACT over all parameters """ + """The maximum ACT over all parameters""" if self.position in self.max_tau_dict: # If we have the ACT at the current position, return it @@ -272,7 +272,7 @@ class Chain(object): @property def tau_nocache(self): - """ Calculate tau forcing a recalculation (no cached tau) """ + """Calculate tau forcing a recalculation (no cached tau)""" tau = max(self.tau_dict.values()) self.max_tau_dict[self.position] = tau self.cached_tau_count = 0 @@ -280,7 +280,7 @@ class Chain(object): @property def tau_last(self): - """ Return the last-calculated tau if it exists, else inf """ + """Return the last-calculated tau if it exists, else inf""" if len(self.max_tau_dict) > 0: return list(self.max_tau_dict.values())[-1] else: @@ -288,7 +288,7 @@ class Chain(object): @property def _tau_for_full_chain(self): - """ The maximum ACT over all parameters """ + """The maximum ACT over all parameters""" return max(self._tau_dict_for_full_chain.values()) @property @@ -297,11 +297,11 @@ class Chain(object): @property def tau_dict(self): - """ Calculate a dictionary of tau (ACT) for every parameter """ + """Calculate a dictionary of tau (ACT) for every parameter""" return self._calculate_tau_dict(self.minimum_index) def _calculate_tau_dict(self, minimum_index): - """ Calculate a dictionary of tau (ACT) for every parameter """ + """Calculate a dictionary of tau (ACT) for every parameter""" logger.debug(f"Calculating tau_dict {self}") # If there are too few samples to calculate tau diff --git a/bilby/bilby_mcmc/proposals.py b/bilby/bilby_mcmc/proposals.py index 99daa824fb8390e26446e73c8d4ff667bc65a564..2c4ffe4ae55ff27ce01baea2d3a14b59b5f4a9bf 100644 --- a/bilby/bilby_mcmc/proposals.py +++ b/bilby/bilby_mcmc/proposals.py @@ -930,7 +930,7 @@ def _stretch_move(sample, complement, scale, ndim, parameters): class EnsembleProposal(BaseProposal): - """ Base EnsembleProposal class for ensemble-based swap proposals """ + """Base EnsembleProposal class for ensemble-based swap proposals""" def __init__(self, priors, weight=1): super(EnsembleProposal, self).__init__(priors, weight) diff --git a/bilby/bilby_mcmc/sampler.py b/bilby/bilby_mcmc/sampler.py index 767e3a65085fb40235e9eebfe0002a9d83ad39a3..a1446e4bed4c3f2cb78c233e1273f54e8bc6fa10 100644 --- a/bilby/bilby_mcmc/sampler.py +++ b/bilby/bilby_mcmc/sampler.py @@ -653,7 +653,7 @@ class BilbyPTMCMCSampler(object): @property def sampler_list(self): - """ A list of all individual samplers """ + """A list of all individual samplers""" return [s for item in self.sampler_dictionary.values() for s in item] @sampler_list.setter diff --git a/bilby/gw/detector/interferometer.py b/bilby/gw/detector/interferometer.py index 874d213dfcbefc87abe1a22e4341a5b2d4838989..8447c16eff482fa3a1abb00d4e5bfd0ecd52a354 100644 --- a/bilby/gw/detector/interferometer.py +++ b/bilby/gw/detector/interferometer.py @@ -1,5 +1,4 @@ import os -import sys import numpy as np @@ -778,9 +777,6 @@ class Interferometer(object): )) def to_hdf5(self, outdir='outdir', label=None): import deepdish - if sys.version_info[0] < 3: - raise NotImplementedError('Pickling of Interferometer is not supported in Python 2.' - 'Use Python 3 instead.') if label is None: label = self.name utils.check_directory_exists_and_if_not_mkdir('outdir') @@ -795,9 +791,6 @@ class Interferometer(object): @docstring(_load_docstring.format(format="hdf5")) def from_hdf5(cls, filename=None): import deepdish - if sys.version_info[0] < 3: - raise NotImplementedError('Pickling of Interferometer is not supported in Python 2.' - 'Use Python 3 instead.') res = deepdish.io.load(filename) if res.__class__ != cls: diff --git a/bilby/gw/detector/networks.py b/bilby/gw/detector/networks.py index bc1067ff94b12ff0a15bccc6c7773f3fa6c6cd37..db0d4743b148338b49590a59c067e9f3f2cc97d9 100644 --- a/bilby/gw/detector/networks.py +++ b/bilby/gw/detector/networks.py @@ -1,5 +1,4 @@ import os -import sys import numpy as np import math @@ -276,11 +275,6 @@ class InterferometerList(list): def to_hdf5(self, outdir="outdir", label="ifo_list"): import deepdish - if sys.version_info[0] < 3: - raise NotImplementedError( - "Pickling of InterferometerList is not supported in Python 2." - "Use Python 3 instead." - ) label = label + "_" + "".join(ifo.name for ifo in self) utils.check_directory_exists_and_if_not_mkdir(outdir) try: @@ -296,11 +290,6 @@ class InterferometerList(list): def from_hdf5(cls, filename=None): import deepdish - if sys.version_info[0] < 3: - raise NotImplementedError( - "Pickling of InterferometerList is not supported in Python 2." - "Use Python 3 instead." - ) res = deepdish.io.load(filename) if res.__class__ == list: res = cls(res) diff --git a/containers/v3-dockerfile-test-suite-python37 b/containers/v3-dockerfile-test-suite-python37 deleted file mode 100644 index bb4d1996639deb30d1975f6aa9d958b4068fe959..0000000000000000000000000000000000000000 --- a/containers/v3-dockerfile-test-suite-python37 +++ /dev/null @@ -1,66 +0,0 @@ -# This dockerfile is written automatically and should not be modified by hand. - -FROM containers.ligo.org/docker/base:conda -LABEL name="bilby CI testing" \ -maintainer="Gregory Ashton <gregory.ashton@ligo.org>" - -RUN conda update -n base -c defaults conda - -ENV conda_env python37 - -RUN conda create -n ${conda_env} python=3.7 -RUN echo "source activate ${conda_env}" > ~/.bashrc -ENV PATH /opt/conda/envs/${conda_env}/bin:$PATH -RUN /bin/bash -c "source activate ${conda_env}" -RUN conda info -RUN python --version - -# Install conda-installable programs -RUN conda install -n ${conda_env} -y matplotlib numpy scipy pandas astropy flake8 mock -RUN conda install -n ${conda_env} -c anaconda coverage configargparse future -RUN conda install -n ${conda_env} -c conda-forge black pytest-cov deepdish arviz - -# Install pip-requirements -RUN pip install --upgrade pip -RUN pip install --upgrade setuptools coverage-badge parameterized - -# Install documentation requirements -RUN pip install sphinx numpydoc nbsphinx sphinx_rtd_theme sphinx-tabs autodoc - -# Install dependencies and samplers -RUN pip install corner healpy cython tables -RUN conda install -n ${conda_env} -c conda-forge dynesty emcee nestle ptemcee -RUN conda install -n ${conda_env} -c conda-forge pymultinest ultranest -RUN conda install -n ${conda_env} -c conda-forge cpnest kombine dnest4 zeus-mcmc -RUN conda install -n ${conda_env} -c conda-forge pytorch -RUN conda install -n ${conda_env} -c conda-forge theano-pymc -RUN conda install -n ${conda_env} -c conda-forge pymc3 -RUN pip install nessai - -# Install Polychord -RUN apt-get update --allow-releaseinfo-change -RUN apt-get install -y build-essential -RUN apt-get install -y libblas3 libblas-dev -RUN apt-get install -y liblapack3 liblapack-dev -RUN apt-get install -y libatlas3-base libatlas-base-dev -RUN apt-get install -y gfortran - -RUN git clone https://github.com/PolyChord/PolyChordLite.git \ -&& (cd PolyChordLite && python setup.py --no-mpi install) - -# Install PTMCMCSampler -RUN git clone https://github.com/jellis18/PTMCMCSampler.git \ -&& (cd PTMCMCSampler && python setup.py install) - -# Install GW packages -RUN conda install -n ${conda_env} -c conda-forge python-lalsimulation -RUN pip install ligo-gracedb gwpy ligo.skymap - -# Add the ROQ data to the image -RUN mkdir roq_basis \ - && cd roq_basis \ - && wget https://git.ligo.org/lscsoft/ROQ_data/raw/master/IMRPhenomPv2/4s/B_linear.npy \ - && wget https://git.ligo.org/lscsoft/ROQ_data/raw/master/IMRPhenomPv2/4s/B_quadratic.npy \ - && wget https://git.ligo.org/lscsoft/ROQ_data/raw/master/IMRPhenomPv2/4s/fnodes_linear.npy \ - && wget https://git.ligo.org/lscsoft/ROQ_data/raw/master/IMRPhenomPv2/4s/fnodes_quadratic.npy \ - && wget https://git.ligo.org/lscsoft/ROQ_data/raw/master/IMRPhenomPv2/4s/params.dat diff --git a/containers/write_dockerfiles.py b/containers/write_dockerfiles.py index b7c154be5de892cddb715dfb941c9e8d7392b71c..d4394c0e44b23e7791ce19778e9f9734c6d1dada 100644 --- a/containers/write_dockerfiles.py +++ b/containers/write_dockerfiles.py @@ -3,7 +3,7 @@ from datetime import date with open("dockerfile-template", "r") as ff: template = ff.read() -python_versions = [(3, 7), (3, 8), (3, 9)] +python_versions = [(3, 8), (3, 9)] today = date.today().strftime("%Y%m%d") for python_major_version, python_minor_version in python_versions: diff --git a/examples/core_examples/radioactive_decay.py b/examples/core_examples/radioactive_decay.py index 682a14a5f3fd59aeb5b78d50937ba91076e8e729..3cd78616c38409bd72de4c9b7029bc15e88297c9 100644 --- a/examples/core_examples/radioactive_decay.py +++ b/examples/core_examples/radioactive_decay.py @@ -36,7 +36,7 @@ def decay_rate(delta_t, halflife, n_init): halflife: float Halflife of atom in minutes n_init: int, float - Initial nummber of atoms + Initial number of atoms """ times = np.cumsum(delta_t) diff --git a/setup.py b/setup.py index b9ef63b24dacc2a0d4a3926207b88622020bb5d3..d195385b11ba6da20807d5acd55e7bc77952ef04 100644 --- a/setup.py +++ b/setup.py @@ -5,10 +5,9 @@ import subprocess import sys import os -# check that python version is 3.7 or above python_version = sys.version_info -if python_version < (3, 7): - sys.exit("Python < 3.7 is not supported, aborting setup") +if python_version < (3, 8): + sys.exit("Python < 3.8 is not supported, aborting setup") def write_version_file(version): @@ -106,7 +105,7 @@ setup( "bilby.gw.eos": ["eos_tables/*.dat"], "bilby": [version_file], }, - python_requires=">=3.7", + python_requires=">=3.8", install_requires=get_requirements(), entry_points={ "console_scripts": [ @@ -115,7 +114,6 @@ setup( ] }, classifiers=[ - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "License :: OSI Approved :: MIT License", diff --git a/test/core/sampler/pymc3_test.py b/test/core/sampler/pymc3_test.py index 9fb710c344159f96a1b3707011ff1aa817f706bf..9978327a95f6a9c37ea36cb9717d2dc0a757c9c2 100644 --- a/test/core/sampler/pymc3_test.py +++ b/test/core/sampler/pymc3_test.py @@ -1,13 +1,11 @@ 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") @pytest.mark.xfail( raises=AttributeError, reason="Dependency issue with pymc3 causes attribute error on import", diff --git a/test/gw/detector/interferometer_test.py b/test/gw/detector/interferometer_test.py index 3c879d22a766955bb5f37a764f075fd8f88a7281..fe17dd5554cefeecd425a09afb2ebcd2693e8688 100644 --- a/test/gw/detector/interferometer_test.py +++ b/test/gw/detector/interferometer_test.py @@ -1,4 +1,3 @@ -import sys import unittest import lal @@ -378,18 +377,14 @@ class TestInterferometer(unittest.TestCase): @pytest.mark.skipif(pandas_version_test, reason=skip_reason) def test_to_and_from_hdf5_loading(self): - if sys.version_info[0] < 3: - with self.assertRaises(NotImplementedError): - self.ifo.to_hdf5(outdir="outdir", label="test") - else: - self.ifo.to_hdf5(outdir="outdir", label="test") - filename = self.ifo._filename_from_outdir_label_extension( - outdir="outdir", label="test", extension="h5" - ) - recovered_ifo = bilby.gw.detector.Interferometer.from_hdf5(filename) - self.assertEqual(self.ifo, recovered_ifo) + self.ifo.to_hdf5(outdir="outdir", label="test") + filename = self.ifo._filename_from_outdir_label_extension( + outdir="outdir", label="test", extension="h5" + ) + recovered_ifo = bilby.gw.detector.Interferometer.from_hdf5(filename) + self.assertEqual(self.ifo, recovered_ifo) - @pytest.mark.skipif(pandas_version_test or sys.version_info[0] < 3, reason=skip_reason) + @pytest.mark.skipif(pandas_version_test, reason=skip_reason) def test_to_and_from_hdf5_wrong_class(self): bilby.core.utils.check_directory_exists_and_if_not_mkdir("outdir") dd.io.save("./outdir/psd.h5", self.power_spectral_density) diff --git a/test/gw/detector/networks_test.py b/test/gw/detector/networks_test.py index b0d02e4eae2e58f7ad43aee61be3365c86137603..6108c3e4ebcacca8b6bf39e8d4c1c6a3b12c9bcf 100644 --- a/test/gw/detector/networks_test.py +++ b/test/gw/detector/networks_test.py @@ -1,4 +1,3 @@ -import sys import unittest import pytest from shutil import rmtree @@ -333,18 +332,12 @@ class TestInterferometerList(unittest.TestCase): @pytest.mark.skipif(pandas_version_test, reason=skip_reason) def test_to_and_from_hdf5_loading(self): - if sys.version_info[0] < 3: - with self.assertRaises(NotImplementedError): - self.ifo_list.to_hdf5(outdir="outdir", label="test") - else: - self.ifo_list.to_hdf5(outdir="outdir", label="test") - filename = "outdir/test_name1name2.h5" - recovered_ifo = bilby.gw.detector.InterferometerList.from_hdf5(filename) - self.assertListEqual(self.ifo_list, recovered_ifo) - - @pytest.mark.skipif( - pandas_version_test or sys.version_info[0] < 3, reason=skip_reason - ) + self.ifo_list.to_hdf5(outdir="outdir", label="test") + filename = "outdir/test_name1name2.h5" + recovered_ifo = bilby.gw.detector.InterferometerList.from_hdf5(filename) + self.assertListEqual(self.ifo_list, recovered_ifo) + + @pytest.mark.skipif(pandas_version_test, reason=skip_reason) def test_to_and_from_hdf5_wrong_class(self): dd.io.save("./outdir/psd.h5", self.ifo_list[0].power_spectral_density) filename = self.ifo_list._filename_from_outdir_label_extension( diff --git a/test/integration/sampler_run_test.py b/test/integration/sampler_run_test.py index 0a0b1b19e23def083e6dd58f69ebfda780e4c3b2..0c40107201c8b2f3572b54fec8bb4f8eab8d595f 100644 --- a/test/integration/sampler_run_test.py +++ b/test/integration/sampler_run_test.py @@ -1,7 +1,6 @@ import unittest import pytest import shutil -import sys import bilby import numpy as np @@ -184,7 +183,6 @@ class TestRunningSamplers(unittest.TestCase): assert "derived" in res.posterior assert res.log_likelihood_evaluations is not None - @pytest.mark.skipif(sys.version_info[1] <= 6, reason="pymc3 is broken in py36") @pytest.mark.xfail( raises=AttributeError, reason="Dependency issue with pymc3 causes attribute error on import",