Skip to content

Commit ee8c54d

Browse files
authored
Merge pull request #19 from zsarnoczay/add_testing
Add integration test harness and CI pipeline
2 parents cbbb662 + 1bc3b7e commit ee8c54d

46 files changed

Lines changed: 742 additions & 1 deletion

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/tests.yml‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
14+
os: [ubuntu-latest, macos-latest, windows-latest]
15+
16+
steps:
17+
- uses: actions/checkout@v6
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v6
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install dependencies
25+
run: pip install -e ".[test]"
26+
27+
- name: Run integration tests
28+
run: pytest tests/test_integration.py -v -m integration

‎README.md‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ The file(s) listed below contain data that is optional for the assessment. If th
155155
The Python file listed below defines additional assessment inputs based on set of default values. Place this file in the input directory of your analysis.
156156
- **optional_inputs.json**: Defines default variables for the impedance_options, repair_time_options, functionality_options, and regional_impact variables listed in the inputs schema.
157157

158+
<!-- How does a user modify the static tables (now data) without touching the original data files? -->
158159

159160
### Static Data
160161
The csv tables listed below contain default component, damage state, system, and tenant function attributes that can be used to populate the required assessment inputs according to the methodology. These are located in the _data_ directory. To override the static data with custom versions, copy modified sheets and place them in the input directory.
@@ -190,3 +191,33 @@ output_dir = './examples/RCSW_4story_pelicun/output'
190191

191192
driver.run_analysis(example_dir, output_dir, seed=985)
192193
```
194+
195+
## Testing
196+
197+
Install the package with test dependencies:
198+
199+
```bash
200+
pip install -e ".[test]"
201+
```
202+
203+
Run the integration tests, which compare Python outputs against stored reference data for each model in `tests/fixtures/models/`:
204+
205+
```bash
206+
pytest tests/test_integration.py -v
207+
```
208+
209+
Integration tests are marked with `@pytest.mark.integration` and can be filtered:
210+
211+
```bash
212+
# Run only integration tests
213+
pytest -m integration
214+
215+
# Skip integration tests
216+
pytest -m "not integration"
217+
```
218+
219+
The comparison engine can also be used standalone for detailed inspection:
220+
221+
```bash
222+
python tests/compare_runs.py <reference_dir> <python_output_dir>
223+
```

‎pyproject.toml‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ classifiers = [
1818
"Operating System :: OS Independent",
1919
]
2020
dependencies = [
21-
"numpy",
21+
"numpy~=2.0",
2222
"pandas",
2323
"scipy",
2424
"matplotlib",
@@ -28,9 +28,18 @@ dependencies = [
2828
[project.scripts]
2929
atc138 = "atc138.cli:main"
3030

31+
[project.optional-dependencies]
32+
test = ["pytest>=7.0"]
33+
3134
[project.urls]
3235
"Homepage" = "https://github.com/NHERI-SimCenter/Functional-Recovery-Python"
3336
"Bug Tracker" = "https://github.com/NHERI-SimCenter/Functional-Recovery-Python/issues"
3437

3538
[tool.setuptools.packages.find]
3639
where = ["src"]
40+
41+
[tool.pytest.ini_options]
42+
pythonpath = ["tests"]
43+
markers = [
44+
"integration: long-running tests comparing full model runs against reference data",
45+
]

0 commit comments

Comments
 (0)