Skip to main content

nrtest

PyPI Package Build Status Documentation Status

nrtest is an end-to-end regression testing framework, designed for scientific software that perform numerical calculations.

Features

nrtest aims to simplify your workflow:

  • JSON files describe the software under test and the tests themselves

  • result files are stored in a portable benchmark directory

  • benchmarks are compared by iterating through tests and their results

  • custom comparisons can easily be added through extensions

Basic Usage

As an example usage, we consider testing TOPAS. This is a Monte Carlo tool for particle simulation, designed for medical physics research. Of course, such a tool must be rigorously validated against experimental data. But it is also useful to frequently run shorter tests, checking for regressions by comparing results to a previous version.

First, we describe the software under test in a configuration file called apps/topas-2.0.3.json. Note that setup_script defines the environment needed to run the software.

{
    "name": "topas",
    "version" : "2.0.3",
    "setup_script" : "/path/to/topas-2.0.3/setup.sh",
    "exe" : "topas"
}

We then describe the test in second configuration file called tests/Scoring_01.json. In doing so, we define the command-line arguments presented to the executable and the input files needed for the test to run. Finally, we also specify the expected output files, and declare how they should be compared to a benchmark. Here we use topas binned, which is a custom comparison routine, though some comparison routines are bundled with nrtest. It is also easy to add your own.

{
    "name": "Scoring_01",
    "version": "1.0",
    "description": "Basic test shooting a 6cm diameter proton beam into a water phantom.",
    "args": [
        "Scoring_01.txt"
    ],
    "input_files": [
        "Scoring_01.txt",
        "GlobalParameters.txt"
    ],
    "output_files": {
        "Dose.csv": "topas binned"
    }
}

To execute the test, we tell nrtest where to find the configuration files and where to output the benchmark. Note that nrtest will search tests/ for tests, though we could have specified tests/Scoring_01.json.

$ nrtest execute apps/topas-2.0.3.json tests/ -o benchmarks/2.0.3
INFO: Found 1 tests
Scoring_01: pass
INFO: Finished

To compare to a previous benchmark:

$ nrtest compare benchmarks/2.0.3 benchmarks/2.0.2
Scoring_01: pass
INFO: Finished

More advanced usage is detailed in the documentation.

History

0.2.5 (2021-08-10)

  • Add ability to skip tests based on minimum_app_version config

0.2.4 (2019-09-11)

  • Fix sporadic failures on Windows when deleting temporary files

0.2.3 (2018-02-09)

  • Add ability to write comparison results to JSON file

0.2.0 (2016-02-21)

  • Add extensions for compare functions

0.1.0 (2016-02-21)

  • First release on PyPI.

Metadata

Release files for nrtest 0.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nrtest 0.2.5
File Size Uploaded Provenance Actions
nrtest-0.2.5.tar.gz 24.7 kB Without provenance Details for nrtest-0.2.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nrtest 0.2.5
File Interpreter ABI Platform Actions
nrtest-0.2.5-py2.py3-none-any.whl Python 2, Python 3 none any Details for nrtest-0.2.5-py2.py3-none-any.whl

Total release size: 39.9 kB

Release files / nrtest-0.2.5.tar.gz

Download URL nrtest-0.2.5.tar.gz
Size 24.7 kB
Tags Source
SHA-256 checksum
How to use checksums
211a0981ca54efd910637f26ed9941a5a4345e16f6865027ad224f06290deb37
BLAKE2b-256 checksum
How to use checksums
8daad359524e1dc6183cc1cc1c25b0425848860d37a3138592b6c4384b272a26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

Release files / nrtest-0.2.5-py2.py3-none-any.whl

Download URL nrtest-0.2.5-py2.py3-none-any.whl
Size 15.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
cc6db77f9aa67509a14905395d3c8c97e4813a3c2b118cec184cb5e76320cf77
BLAKE2b-256 checksum
How to use checksums
906b035b80f4dde115cb2b33f08c21427536d5fb3d5e27d37d676de417ff96e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

Security for nrtest 0.2.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page