-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: header test | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
activate-environment: test_env | ||
python-version: 3.8 | ||
auto-activate-base: false | ||
- name: Install dependencies | ||
run: | | ||
conda install mpi4py "numpy<2" setuptools | ||
pip install pyomo addheader pyyaml pytest | ||
- name: setup the program | ||
run: | | ||
pip install -e . | ||
- name: run headers test | ||
timeout-minutes: 10 | ||
run: | | ||
cd mpisppy/tests | ||
python test_headers.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
############################################################################### | ||
# mpi-sppy: MPI-based Stochastic Programming in PYthon | ||
# | ||
# Copyright (c) 2024, Lawrence Livermore National Security, LLC, Alliance for | ||
# Sustainable Energy, LLC, The Regents of the University of California, et al. | ||
# All rights reserved. Please see the files COPYRIGHT.md and LICENSE.md for | ||
# full copyright and license information. | ||
############################################################################### | ||
|
||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
yaml = pytest.importorskip("yaml") | ||
addheader = pytest.importorskip("addheader") | ||
|
||
from addheader.add import FileFinder, detect_files | ||
import mpisppy | ||
|
||
def test_headers(): | ||
root = Path(mpisppy.__file__).parent.parent | ||
|
||
conf = root / "addheader.yml" | ||
with open(conf) as f: | ||
conf = yaml.safe_load(f) | ||
conf = conf["patterns"] | ||
|
||
has_header, missing_header = detect_files(FileFinder(root, glob_patterns=conf)) | ||
nonempty_missing_header = [] | ||
for p in missing_header: | ||
if p.stat().st_size == 0: | ||
continue | ||
nonempty_missing_header.append(p) | ||
assert not nonempty_missing_header |