Skip to content
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
15 changes: 5 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12"]
python-version: ["3.11", "3.13"]
optional: [false]
include:
- python-version: "3.11"
optional: true

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -33,19 +33,14 @@ jobs:
python -m pip install --upgrade pip
pip install git+https://github.com/NREL/HOPP@develop
if [ "${{ matrix.optional }}" = "true" ]; then
pip install ".[develop,gis]"
pip install ".[develop]"
pip install git+https://github.com/NREL/MarineCarbonManagement.git
else
pip install ".[develop,gis]"
pip install ".[develop]"
fi
- name: Create env file
run: |
touch .env
- name: Run tests
run: |
pytest .
- name: Lint with flake8
run: |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
pip install flake8
flake8 . --count --exit-zero --statistics --ignore=E501
21 changes: 0 additions & 21 deletions .github/workflows/ci_docs.yml

This file was deleted.

52 changes: 0 additions & 52 deletions .github/workflows/gh_pages.yml

This file was deleted.

11 changes: 6 additions & 5 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
name: pre-commit

on:
pull_request:
push:
branches: [main]
branches: [main, develop]
pull_request:
branches: [main, develop]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: 3.9
python-version: 3.13
- name: Run pre-commit
uses: pre-commit/action@v3.0.1
6 changes: 3 additions & 3 deletions .github/workflows/publish_to_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: 3.9
python-version: 3.13
- name: Build package
run: |
python -m pip install --upgrade pip
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish_to_test_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: 3.9
python-version: 3.13
- name: Build package
run: |
python -m pip install --upgrade pip
Expand Down
47 changes: 47 additions & 0 deletions examples/test/test_all_examples.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import io
import os
import builtins
import importlib
from pathlib import Path

Expand All @@ -10,6 +12,51 @@
from h2integrate.core.h2integrate_model import H2IntegrateModel


ROOT = Path(__file__).parents[1]
print(f"{ROOT=}")


def patch_open(open_func, files):
def open_patched(
path,
mode="r",
buffering=-1,
encoding=None,
errors=None,
newline=None,
closefd=True,
opener=None,
):
if "w" in mode and not Path(path).is_file():
files.append(path)
return open_func(
path,
mode=mode,
buffering=buffering,
encoding=encoding,
errors=errors,
newline=newline,
closefd=closefd,
opener=opener,
)

return open_patched


@pytest.fixture(autouse=True)
def cleanup_files(monkeypatch):
files = []
monkeypatch.setattr(builtins, "open", patch_open(builtins.open, files))
monkeypatch.setattr(io, "open", patch_open(io.open, files))
yield
for f in files:
if (f := Path(f)).is_relative_to(ROOT):
try:
f.unlink()
except FileNotFoundError:
pass


def test_steel_example(subtests):
# Change the current working directory to the example's directory
os.chdir(EXAMPLE_DIR / "01_onshore_steel_mn")
Expand Down
Loading