From 8019f6081dc59cbadd6ee862e25dde624b10b2a1 Mon Sep 17 00:00:00 2001 From: Johannes Buchner Date: Sun, 26 Nov 2017 22:12:29 -0300 Subject: [PATCH] added CI --- .coveragerc | 23 ++++++++++++++++ .travis.yml | 60 ++++++++++++++++++++++++++++++++++++++++++ conda-requirements.txt | 3 +++ pymultinest/run.py | 1 + setup.cfg | 2 ++ setup.py | 2 ++ 6 files changed, 91 insertions(+) create mode 100644 .coveragerc create mode 100644 .travis.yml create mode 100644 conda-requirements.txt create mode 100644 setup.cfg diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..681dd90 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,23 @@ +# +# .coveragerc to control coverage.py +# + +[run] +branch = True +omit = + test* + + +[report] +exclude_lines = + pragma: no cover + def __repr__ + if __name__ == .__main__. +omit = + .eggs/* + /home/travis/.local/lib/* + test*.py + setup.py + __init__.py + + diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..8c4b424 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,60 @@ +language: python + +python: + - "2.7" + - "3.5" + +compiler: + - gcc + +install: + # Fetch and install conda + # ----------------------- + - export CONDA_BASE="http://repo.continuum.io/miniconda/Miniconda" + - if [[ "${TRAVIS_PYTHON_VERSION}" == 2* ]]; then + wget ${CONDA_BASE}2-latest-Linux-x86_64.sh -O miniconda.sh; + else + wget ${CONDA_BASE}3-latest-Linux-x86_64.sh -O miniconda.sh; + fi + - bash miniconda.sh -b -p ${HOME}/miniconda + - export PATH="${HOME}/miniconda/bin:${PATH}" + - hash -r + + # Create the testing environment + # ------------------------------ + - conda config --set always_yes yes + - conda config --set changeps1 no + - conda config --set show_channel_urls true + - conda config --add channels conda-forge + - conda update --quiet conda + - ENV_NAME="test-environment" + - conda create --quiet -n ${ENV_NAME} python=${TRAVIS_PYTHON_VERSION} + - source activate ${ENV_NAME} + + # Customise the testing environment + # --------------------------------- + - conda install --quiet --file conda-requirements.txt + - pip install --user coveralls + - pip install --user codecov + + # Summerise environment + # --------------------- + - conda list + - conda info -a + + # Install and test + - git clone https://github.com/JohannesBuchner/MultiNest.git + - pushd MultiNest/build && cmake .. && make && popd + - test -e MultiNest/lib/libmultinest.so + - python setup.py install --user + + - git clone https://github.com/JohannesBuchner/cuba.git + - pushd cuba && ./configure && ./makeshared.sh && popd + +script: + - LD_LIBRARY_PATH=MultiNest/lib/:${LD_LIBRARY_PATH} python -c 'import pymultinest' + - LD_LIBRARY_PATH=MultiNest/lib/:${LD_LIBRARY_PATH} coverage run setup.py test + +after_success: coveralls + + diff --git a/conda-requirements.txt b/conda-requirements.txt new file mode 100644 index 0000000..f23634b --- /dev/null +++ b/conda-requirements.txt @@ -0,0 +1,3 @@ +numpy +scipy +matplotlib diff --git a/pymultinest/run.py b/pymultinest/run.py index f9f0ff5..3e0cecd 100644 --- a/pymultinest/run.py +++ b/pymultinest/run.py @@ -246,6 +246,7 @@ def dumper(nSamples,nlive,nPar, sb, seed, wraps, verbose, resume, write_output, init_MPI, log_zero, max_iter, loglike, dumper, context] + print(args) args_converted = [converter(v) for v, converter in zip(args, argtypes)] lib.run(*args_converted) signal.signal(signal.SIGINT, prev_handler) diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..b7e4789 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[aliases] +test=pytest diff --git a/setup.py b/setup.py index e5b82b5..eafb63c 100644 --- a/setup.py +++ b/setup.py @@ -25,5 +25,7 @@ requires = ["ctypesGsl", "numpy (>=1.5)", "matplotlib", "scipy"], scripts=['multinest_marginals.py'], long_description=long_description, + setup_requires=['pytest-runner'], + tests_require=['pytest'], )