Closed rburghol closed 1 month ago
Develop specific performance (accuracy, and/or efficiency) testing of hsp2 model runs. Extends work #135
hsp2 import
hsp2 run
test10.h5
environment_dev.yml
pytest
pip install -e .[dev] # make sure test dependencies are installed pip install pytest-xdist # allow running tests in parallel pip install pytest-cov # permit more verbose/detailed tests
Basic testing in HSPsquared/tests/ (from @PaulDudaRESPEC @austinorr)
HSPsquared/tests/
NUMBA_DISABLE_JIT=1 hsp2 run test10specl.h5
pytest -k test_case
pytest -k test_case -n 2
pytest-cov
NUMBA_DISABLE_JIT=1 pytest -k test_case --cov --cov-branch --cov-report term-missing
test_
import pytest import os
def test_h5_file_exists(): assert os.path.exists('test10.h5')
def test_that_should_fail(): assert os.path.exists('nonexistent_h5_file.h5')
Overview
Develop specific performance (accuracy, and/or efficiency) testing of hsp2 model runs. Extends work #135
hsp2 import
completes correctlyhsp2 run
completes without errortest10.h5
is simulated correctly, likeTasks:
(will not do for the time being) Develop working install forenvironment_dev.yml
(see https://github.com/respec/HSPsquared/blob/dependency_options/environment_dev.yml)Code
Install
pytest
etc.Compare Outputs from test10.uci and test10specl.uci
Basic testing in
HSPsquared/tests/
(from @PaulDudaRESPEC @austinorr)NUMBA_DISABLE_JIT=1 hsp2 run test10specl.h5
pytest -k test_case
pytest -k test_case -n 2
pytest-cov
):NUMBA_DISABLE_JIT=1 pytest -k test_case --cov --cov-branch --cov-report term-missing
Very simple pytest
test_
will be automatically executed.def test_h5_file_exists(): assert os.path.exists('test10.h5')
This shows how how to break the test
def test_that_should_fail(): assert os.path.exists('nonexistent_h5_file.h5')