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: 18 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,26 @@ jobs:
brew:
- hdf5-mpi
envs: |
# Main tests
# Tests that don't rely on Fortran binaries
- linux: py39-test-nobinaries
- linux: py310-test-nobinaries
- linux: py311-test-nobinaries
- linux: py312-test-nobinaries
- macos: py39-test-nobinaries
- macos: py310-test-nobinaries
- macos: py311-test-nobinaries
- macos: py312-test-nobinaries
- windows: py39-test-nobinaries
- windows: py310-test-nobinaries
- windows: py311-test-nobinaries
- windows: py312-test-nobinaries

# Main tests including Fortran binaries
- linux: py39-test
# - macos: py310-test-macos
# runs-on: macos-14
- linux: py310-test
- linux: py311-test
# - macos: py312-test-macos
# runs-on: macos-14
- linux: py312-test

# Bit-level tests
- linux: py39-test-bitlevel
runs-on: ubuntu-20.04
Expand Down
68 changes: 0 additions & 68 deletions hyperion/__init__.py
Original file line number Diff line number Diff line change
@@ -1,71 +1,3 @@
from __future__ import print_function, division

from .version import __version__

# Set up the test function
_test_runner = None


def _get_test_runner():
from .testing.helper import TestRunner
return TestRunner(__path__[0])


def test(package=None, test_path=None, args=None, plugins=None,
verbose=False, pastebin=None, generate_reference=False,
bit_level_tests=False, coverage=False):
'''
Run Hyperion tests using py.test. A proper set of arguments is
constructed and passed to `pytest.main`.

Parameters
----------
package : str, optional
The name of a specific package to test, e.g. 'model' or
'densities'. If nothing is specified all default Hyperion tests
are run.

test_path : str, optional
Specify location to test by path. May be a single file or
directory. Must be specified absolutely or relative to the
calling directory.

args : str, optional
Additional arguments to be passed to `pytest.main` in the `args`
keyword argument.

plugins : list, optional
Plugins to be passed to `pytest.main` in the `plugins` keyword
argument.

verbose : bool, optional
Convenience option to turn on verbose output from py.test. Passing
True is the same as specifying `-v` in `args`.

pastebin : {'failed','all',None}, optional
Convenience option for turning on py.test pastebin output. Set to
'failed' to upload info for failed tests, or 'all' to upload info
for all tests.

generate_reference : str
Generate reference results for bit-level tests

bit_level_tests : bool
Run bit-level tests. These are time-consuming tests that check the
exact validity of the output, but they are disabled by default.

coverage : bool, optional
Generate a test coverage report. The result will be placed in
the directory htmlcov.

See Also
--------
pytest.main : py.test function wrapped by `run_tests`.

'''
test_runner = _get_test_runner()
return test_runner.run_tests(
package=package, test_path=test_path, args=args,
plugins=plugins, verbose=verbose, pastebin=pastebin,
generate_reference=generate_reference,
bit_level_tests=bit_level_tests, coverage=coverage)
4 changes: 0 additions & 4 deletions hyperion/grid/amr_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,10 +608,6 @@ def from_yt(cls, ds, quantity_mapping={}):
"""

import yt
from distutils.version import LooseVersion

if not LooseVersion(yt.__version__) >= LooseVersion('3'):
raise ImportError("yt 3.0 or later is required")

from .yt_wrappers import yt_dataset_to_amr_grid
return yt_dataset_to_amr_grid(ds, quantity_mapping=quantity_mapping)
Expand Down
9 changes: 3 additions & 6 deletions hyperion/grid/tests/test_yt.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
import sys
from copy import deepcopy
from distutils.version import LooseVersion
import h5py
import numpy as np
import pytest
Expand All @@ -21,10 +20,7 @@
except:
YT_VERSION = None
else:
if LooseVersion(yt.__version__) >= LooseVersion('3'):
YT_VERSION = 3
else:
YT_VERSION = 2
YT_VERSION = 3

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

Expand Down Expand Up @@ -91,7 +87,8 @@ def test_to_yt(self, tmpdir, grid_type):
p.save(tmpdir.join('test.png').strpath)


@pytest.mark.skipif("YT_VERSION is None or YT_VERSION < 3")
@pytest.mark.requires_hyperion_binaries
@pytest.mark.skipif("YT_VERSION is None")
def test_from_yt(tmpdir):

from yt import load
Expand Down
Loading