Testing
JANUS uses pytest for its test suite. The tests verify physical correctness by comparing model output against known reference values, and check utility functions and constants.
Prerequisites
Install the test dependencies:
pip install pytest
pip install -r examples/requirements.txt
Make sure RAD_DIR and FWL_DATA are set before running:
echo $RAD_DIR # should point to your SOCRATES installation
echo $FWL_DATA # should point to your data directory
Running the tests
From the root of the JANUS repository:
pytest tests/
To run a specific test file:
pytest tests/test_runaway_greenhouse.py
pytest tests/test_instellation.py
pytest tests/test_constants.py
pytest tests/test_code.py
To run with verbose output:
pytest tests/ -v
What the tests check
test_runaway_greenhouse.py
Runs the full JANUS pipeline at three surface temperatures for a pure HβO atmosphere at 0.3 AU and checks the OLR against reference values to a relative tolerance of 1 Γ 10β»β΅:
| T_surf (K) | Expected OLR (W mβ»Β²) | Regime |
|---|---|---|
| 200 | 90.73 | Sub-runaway |
| 1705 | 278.88 | SimpsonβNakajima plateau |
| 2800 | 6581.74 | Post-runaway |
Uses RadConvEqm() with cp_dry=False, trppD=False, rscatter=False.
test_instellation.py
Runs MCPA_CBL() β the coupled boundary layer solver β at two orbital
distances (0.3 AU and 1.4 AU) using config_instellation.toml and checks
five output quantities against reference values:
(SW_flux_down[0], LW_flux_up[0], net_flux[0], ts, trppT)
Unlike the runaway greenhouse test this uses rscatter=True and
setTropopauseTemperature() (dynamic skin-temperature tropopause).
test_constants.py
Checks physical constants and utility functions:
gravity()decreases with radius as expectedEarthplanet constants match database values (g = 9.798,albedo = 0.306,Tsbar = 288.0)cpv()returns finite, positive heat capacities for HβO, COβ, Nβ, Hβ, CHβ, Oβ
test_code.py
Checks utility code and the CLI:
setup_logger()sets the correct log level and handler count; raisesValueErrorfor invalid levelsnatural_sort()correctly sorts filenames with embedded numbersjanus envCLI command exits successfully and printsRAD_DIR