Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
HYPERION_HDF5_VERSION=18 ./configure
make
make install
- run:
name: Upgrade setuptools and pip
command: pip install setuptools pip --upgrade
- run:
name: Installing Numpy
command: pip install numpy==1.11.3
Expand All @@ -29,10 +32,10 @@ jobs:
command: pip install Cython==0.24.1
- run:
name: Installing Python package
command: pip install .[test] matplotlib==1.5.3 astropy==1.2.2 h5py==2.4.0 yt==3.2.3
command: pip install -e .[test] matplotlib==1.5.3 astropy==1.2.2 h5py==2.4.0 yt==3.2.3
- run:
name: Run full test suite (including bit-level tests)
command: python setup.py test --enable-bit-level-tests
command: pytest hyperion --enable-bit-level-tests

# Build with HDF5 1.8
hdf5-18:
Expand All @@ -51,15 +54,21 @@ jobs:
HYPERION_HDF5_VERSION=18 ./configure
make
make install
- run:
name: Upgrade setuptools and pip
command: pip install setuptools pip --upgrade
- run:
name: Installing Numpy
command: pip install numpy
command: pip install numpy Cython
- run:
name: Installing Python package
command: pip install .[test]
command: pip install -e .[test]
- run:
name: Ensure an old version of pytest is available
command: pip install "pytest<3.7,>=2.8"
- run:
name: Run full test suite (including bit-level tests)
command: python setup.py test --enable-bit-level-tests
command: pytest hyperion --enable-bit-level-tests

# Build with HDF5 1.10
hdf5-110:
Expand All @@ -83,10 +92,10 @@ jobs:
command: pip3 install numpy
- run:
name: Installing Python package
command: pip3 install .[test]
command: pip3 install -e .[test]
- run:
name: Run full test suite (including bit-level tests)
command: python3 setup.py test --enable-bit-level-tests
command: pytest hyperion --enable-bit-level-tests

workflows:
version: 2
Expand Down
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:
global:
- SETUP_XVFB=True
- CONDA_CHANNELS='conda-forge'
- CONDA_DEPENDENCIES='numpy astropy h5py matplotlib yt mpich hdf5'
- CONDA_DEPENDENCIES='numpy astropy h5py matplotlib yt mpich hdf5 hdf5-static'
- SETUP_CMD='test'
- MPLBACKEND='Agg'
matrix:
Expand All @@ -23,8 +23,9 @@ install:
- if [[ $TRAVIS_OS_NAME == osx ]]; then conda install clang_osx-64 clangxx_osx-64 gfortran_osx-64; fi

script:
- set -e
- ./configure
- make serial
- sudo make install
- python setup.py install # to get the hyperion script installed
- python setup.py $SETUP_CMD
- pip install -e .[test]
- pytest hyperion
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,6 @@ vor_mpi: $(OBJECTS_VOR_MPI)

install: bin/hyperion_*
mkdir -p @prefix@/bin
cp bin/hyperion_* @prefix@/bin/
cp -r bin/hyperion_* @prefix@/bin/

clean:; rm *.mod src/*.mod src/*/*.mod *.o */*.o bin/* *~ */*~ fort.* ; echo "This file can be deleted." > bin/empty.txt ; echo "This file can be deleted." > src/modules/empty.txt
12 changes: 10 additions & 2 deletions hyperion/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@
from .util.nans import NaNWarning



def pytest_addoption(parser):
parser.addoption('--generate-reference', help="generate reference results for bit-level tests", type="string")
parser.addoption('--enable-bit-level-tests', help="enable bit-level tests", action="store_true")


def pytest_configure(config):
warnings.simplefilter('error', NaNWarning)
warnings.simplefilter('error', NaNWarning)


def pytest_collection_modifyitems(config, items):
if config.getoption("--enable-bit-level-tests"):
return
skip_bit_level = pytest.mark.skip(reason="need --enable-bit-level-tests option to run")
for item in items:
if "bitlevel" in item.keywords:
item.add_marker(skip_bit_level)
19 changes: 8 additions & 11 deletions hyperion/model/tests/test_bit_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
import shutil
import itertools

try:
import pytest
except:
from astropy.tests.helper import pytest
import pytest

import numpy as np

from six import StringIO
Expand All @@ -26,7 +24,6 @@

DATA = os.path.join(os.path.dirname(__file__), 'data')

bit_level = pytest.mark.skipif(str(not pytest.config.getoption('enable_bit_level_tests')))

@pytest.fixture(scope="module")
def generate(request):
Expand Down Expand Up @@ -137,7 +134,7 @@ def setup_class(self):
setup_all_grid_types(self, pc, 1.e-20)
self.dust_file = os.path.join(DATA, 'kmh_lite.hdf5')

@bit_level
@pytest.mark.bitlevel
@pytest.mark.parametrize(('grid_type', 'sample_sources_evenly', 'multiple_densities'), list(itertools.product(GRID_TYPES, [False, True], [False, True])))
def test_specific_energy(self, tmpdir, grid_type, sample_sources_evenly, multiple_densities, generate):

Expand Down Expand Up @@ -175,7 +172,7 @@ def test_specific_energy(self, tmpdir, grid_type, sample_sources_evenly, multipl
reference_file = os.path.join(DATA, function_name() + ".rtout")
assert_identical_results(output_file, reference_file)

@bit_level
@pytest.mark.bitlevel
@pytest.mark.parametrize(('grid_type', 'raytracing', 'sample_sources_evenly'), list(itertools.product(GRID_TYPES, [False, True], [False, True])))
def test_peeloff(self, tmpdir, grid_type, raytracing, sample_sources_evenly, generate):

Expand Down Expand Up @@ -339,7 +336,7 @@ def setup_class(self):
def teardown_class(self):
shutil.rmtree(self.tmpdir)

@bit_level
@pytest.mark.bitlevel
@pytest.mark.parametrize(('tau'), [0.1, 1, 10, 100])
def test_pascucci(self, tmpdir, tau, generate):

Expand Down Expand Up @@ -445,7 +442,7 @@ class TestPinteBenchmark(object):
The current tests do not test the imaging part of the Pinte benchmark.
'''

@bit_level
@pytest.mark.bitlevel
@pytest.mark.parametrize(('tau'), [1000, 10000, 100000, 1000000])
def test_pinte_seds(self, tmpdir, tau, generate):

Expand Down Expand Up @@ -547,7 +544,7 @@ def test_pinte_seds(self, tmpdir, tau, generate):
reference_file = os.path.join(DATA, function_name() + ".rtout")
assert_identical_results(output_file, reference_file)

@bit_level
@pytest.mark.bitlevel
@pytest.mark.parametrize(('tau'), [1000, 10000, 100000, 1000000])
def test_pinte_images(self, tmpdir, tau, generate):

Expand Down Expand Up @@ -638,7 +635,7 @@ def test_pinte_images(self, tmpdir, tau, generate):
reference_file = os.path.join(DATA, function_name() + ".rtout")
assert_identical_results(output_file, reference_file)

@bit_level
@pytest.mark.bitlevel
@pytest.mark.parametrize(('tau'), [1000, 10000, 100000, 1000000])
def test_pinte_specific_energy(self, tmpdir, tau, generate):

Expand Down
33 changes: 33 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[metadata]
name = Hyperion
url = http://www.hyperion-rt.org
author = Thomas Robitaille
author_email = thomas.robitaille@gmail.com
license = BSD
description = Monte-Carlo Radiative Transfer Code

[options]
zip_safe = True
packages = find:
include_package_data = True
setup_requires = numpy>=1.11
install_requires =
numpy>=1.11
matplotlib>=1.5
astropy>=1.2
h5py>=2.4
yt>=3.2
six

[options.extras_require]
docs =
sphinx
numpydoc
test =
pytest

[options.package_data]
hyperion.model.tests = data/*.rtout, data/*.hdf5
hyperion.importers.tests = data/*.hdf5
hyperion.grid.tests = data/*.hdf5, data/DD0010/*
hyperion.testing = coveragerc
26 changes: 4 additions & 22 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from distutils.command.build_ext import build_ext

from hyperion.testing.helper import HyperionTest
from hyperion.version import __version__, __dev__
from hyperion.version import __version__


class custom_sdist(sdist):
Expand Down Expand Up @@ -81,25 +81,7 @@ def run(self):
extra_compile_args = ['-O2', '-Wno-error=declaration-after-statement'],
extra_link_args=['-lstdc++'])]

scripts = ['hyperion', 'hyperion2fits']

setup(name='Hyperion',
version=__version__,
url='http://www.hyperion-rt.org',
description='Monte-Carlo Radiative Transfer Code',
long_description='Monte-Carlo Radiative Transfer Code',
author='Thomas Robitaille',
author_email='thomas.robitaille@gmail.com',
license='BSD',
packages=find_packages(),
package_data={'hyperion.model.tests': ['data/*.rtout', 'data/*.hdf5'],
'hyperion.importers.tests': ['data/*.hdf5'],
'hyperion.grid.tests': ['data/*.hdf5', 'data/DD0010/*'],
'hyperion.testing': ['coveragerc']},
scripts=['scripts/' + x for x in scripts],
setup(version=__version__,
scripts=['scripts/hyperion', 'scripts/hyperion2fits'],
cmdclass=cmdclass,
ext_modules=ext_modules,
setup_requires=['numpy>=1.11'],
install_requires=['numpy>=1.11', 'matplotlib>=1.5', 'astropy>=1.2', 'h5py>=2.4', 'yt>=3.2', 'six'],
extras_require={'test': ['pytest'],
'docs': ['sphinx', 'numpydoc']})
ext_modules=ext_modules)