Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integration test for PROTEUS #149

Merged
merged 22 commits into from
Aug 27, 2024
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
55 changes: 50 additions & 5 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,15 @@ jobs:
matrix:
python-version: ['3.10']

env:
FWL_DATA: /home/runner/work/fwl_data
RAD_DIR: ./SOCRATES
SOCRATES: ./SOCRATES # https://github.com/FormingWorlds/JANUS/issues/51

steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
submodules: 'false'

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
Expand All @@ -44,17 +49,57 @@ jobs:
run: |
python -m pip install -e .[develop]

- name: Install JANUS+MORS
run: |
python -m pip install git+https://github.com/FormingWorlds/MORS
python -m pip install git+https://github.com/FormingWorlds/JANUS

- name: Setup system for SOCRATES
run: |
sudo apt-get update
sudo apt-get install libnetcdff-dev netcdf-bin

- name: Get SOCRATES
uses: actions/checkout@v4
with:
repository: 'FormingWorlds/SOCRATES'
path: 'SOCRATES'

- uses: actions/cache@v3
id: cache-socrates
with:
path: |
SOCRATES/bin
SOCRATES/sbin
SOCRATES/set_rad_env
key: socrates-${{ hashFiles('SOCRATES/version') }}

- name: Build SOCRATES
if: steps.cache-socrates.outputs.cache-hit != 'true'
run: |
export LD_LIBRARY_PATH=""
cd SOCRATES
./configure
./build_code
cd ..

- uses: actions/cache@v3
id: cache-fwl-data
with:
path: /home/runner/work/fwl_data
key: fwl-data-1
path: ${{ env.FWL_DATA }}
key: fwl-data-2

- name: Pre-download fwl data
if: steps.cache-fwl-data.cache-hit != 'true'
run: |
mors download all
janus download stellar
janus download spectral
janus download spectral -n Frostflow -b 48

- name: Test with pytest
run: |
source PROTEUS.env
export FWL_DATA="/home/runner/work/fwl_data"
export RAD_DIR="./SOCRATES"
coverage run -m pytest

- name: Report coverage
Expand Down
2 changes: 1 addition & 1 deletion src/proteus/utils/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def set_properties( self, nrows, ncols, width, height ):
# Set main font properties
font_d = {
'size': 10.0,
'family': ['Arial','sans-serif']
'family': ['sans-serif']
}

# fonts = fm.findSystemFonts(fontpaths=None, fontext='ttf')
Expand Down
29 changes: 29 additions & 0 deletions tests/integration/test_proteus_start.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from __future__ import annotations

import os
from pathlib import Path

import pytest
from helpers import PROTEUS_ROOT

from proteus import Proteus

if os.getenv('CI'):
# https://github.com/FormingWorlds/PROTEUS/pull/149
pytest.skip(reason='No way of currently testing this on the CI.', allow_module_level=True)


def test_dummy_run():
config_path = PROTEUS_ROOT / 'input' / 'dummy.toml'

runner = Proteus(config_path=config_path)

runner.config['log_level'] = 'WARNING'
runner.config['plot_iterfreq'] = 0
runner.config['iter_max'] = 0

runner.start()

output = Path(runner.directories['output'])

assert 'Completed' in (output / 'status').read_text()
Loading