Skip to content

Commit 2142eaf

Browse files
Add pytests for FANS (#55)
* added a pixi based recipe to create a virtual env for fans_dashboard * manual pre-commit trigger * changed build from setuptools to hatchling * added tests * manual pre-commit trigger... AGAIN * added pytest for checking Voigt Reuss bounds on Linear elastic tangent * manual precommit trigegr * updated changelog * add empty line in changlog * Remove pytests layer of folder and shorten docstrings of each test * modified base path for pytests * modified build and test to include pytest at the end * Install pixi in fans-ci Docker image recipe * modified build and test CI * modified pixi install command in CI * removed shell login * Use setup-pixi action to set up pixi * Do not point to test/unit folder while running pytest via pixi * Remove the pixi install command from the Docker recipe as pixi is now set up in the Action workflow * printing location of h5 file to see where it is * changed base dir for pytests * changed path of h5 in the test cmake file * added separate base dirs for json and h5 in pytests * added pixi setup to the macos CI * added test readme * added blank line * added blank line * added blank line * Empty-Commit * Update test/README.md Co-authored-by: Ishaan Desai <ishaandesai@gmail.com> * Update test/README.md Co-authored-by: Ishaan Desai <ishaandesai@gmail.com> * Update test/README.md Co-authored-by: Ishaan Desai <ishaandesai@gmail.com> * Update test/README.md Co-authored-by: Ishaan Desai <ishaandesai@gmail.com> --------- Co-authored-by: Ishaan Desai <ishaandesai@gmail.com>
1 parent 646c32e commit 2142eaf

31 files changed

+4521
-36
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SCM syntax highlighting & preventing 3-way merges
2+
pixi.lock merge=binary linguist-language=YAML linguist-generated=true

.github/workflows/build_and_test.yaml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ jobs:
3232
- name: Checkout code
3333
uses: actions/checkout@v4
3434

35+
- name: Set up pixi
36+
uses: prefix-dev/setup-pixi@v0.8.8
37+
3538
- name: Generate build directory
3639
run: mkdir -p ${{ env.FANS_BUILD_DIR }}
3740

@@ -67,10 +70,30 @@ jobs:
6770

6871
- name: Tests
6972
working-directory: ${{ env.FANS_BUILD_DIR }}
70-
run: su -c "ctest" ${{ env.FANS_MPI_USER }}
73+
run: |
74+
su -c "ctest" ${{ env.FANS_MPI_USER }}
7175
7276
- uses: actions/upload-artifact@v4
7377
if: failure()
7478
with:
7579
name: ${{ format('Ubuntu {0}', matrix.UBUNTU_VERSION) }} CTest logs
7680
path: ${{ env.FANS_BUILD_DIR }}/Testing/Temporary/LastTest.log
81+
82+
# ────────────────────────────────────────────────────────────────
83+
# Pytest checks
84+
# ────────────────────────────────────────────────────────────────
85+
- name: Install Pixi Python deps
86+
run: |
87+
pixi --version
88+
pixi install
89+
90+
- name: Run pytest checks on HDF5 output
91+
run: pixi run test
92+
93+
- uses: actions/upload-artifact@v4
94+
if: failure()
95+
with:
96+
name: ${{ format('Ubuntu {0}', matrix.UBUNTU_VERSION) }} PyTest logs
97+
path: |
98+
**/pytest*.xml
99+
**/.pytest_cache

.github/workflows/build_and_test_mac.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ jobs:
3131
brew install open-mpi --build-from-source --cc=gcc-14
3232
brew install fftw hdf5-mpi eigen
3333
34+
- name: Set up pixi
35+
uses: prefix-dev/setup-pixi@v0.8.8
36+
3437
- name: Generate build directory
3538
run: mkdir -p ${{ env.FANS_BUILD_DIR }}
3639

@@ -77,3 +80,22 @@ jobs:
7780
with:
7881
name: macOS 15 CTest logs
7982
path: ${{ env.FANS_BUILD_DIR }}/Testing/Temporary/LastTest.log
83+
84+
# ────────────────────────────────────────────────────────────────
85+
# Pytest checks
86+
# ────────────────────────────────────────────────────────────────
87+
- name: Install Pixi Python deps
88+
run: |
89+
pixi --version
90+
pixi install
91+
92+
- name: Run pytest checks on HDF5 output
93+
run: pixi run test
94+
95+
- uses: actions/upload-artifact@v4
96+
if: failure()
97+
with:
98+
name: ${{ format('Ubuntu {0}', matrix.UBUNTU_VERSION) }} PyTest logs
99+
path: |
100+
**/pytest*.xml
101+
**/.pytest_cache

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,3 +205,7 @@ test/input_files/**/*.json
205205
!test_LinearThermal.json
206206
!test_PseudoPlastic.json
207207
!test_J2Plasticity.json
208+
209+
# pixi environments
210+
.pixi
211+
*.egg-info

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## latest
44

5+
- Add a pixi environment for the FANS_dashboard and some tests https://github.com/DataAnalyticsEngineering/FANS/pull/55
56
- Remove MPI initialization from pyFANS and add an integration test for it https://github.com/DataAnalyticsEngineering/FANS/pull/46
67
- Native support for MacOS https://github.com/DataAnalyticsEngineering/FANS/pull/25
78
- Remove Ubuntu 20.04 from testing and Docker support https://github.com/DataAnalyticsEngineering/FANS/pull/51

FANS_Dashboard/FANS_Dashboard.ipynb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@
5151
"outputs": [],
5252
"source": [
5353
"import numpy as np\n",
54-
"from FANS_Dashboard_utils import *\n",
55-
"from postprocessing import compute_rank2tensor_measures\n",
56-
"from h52xdmf import write_xdmf\n",
57-
"from plotting import plot_subplots"
54+
"from fans_dashboard.core.utils import *\n",
55+
"from fans_dashboard.core.postprocessing import compute_rank2tensor_measures\n",
56+
"from fans_dashboard.plotting.h52xdmf import write_xdmf\n",
57+
"from fans_dashboard.plotting.plotting import plot_subplots"
5858
]
5959
},
6060
{
@@ -323,7 +323,7 @@
323323
],
324324
"metadata": {
325325
"kernelspec": {
326-
"display_name": "Python 3",
326+
"display_name": "default",
327327
"language": "python",
328328
"name": "python3"
329329
},
@@ -337,7 +337,7 @@
337337
"name": "python",
338338
"nbconvert_exporter": "python",
339339
"pygments_lexer": "ipython3",
340-
"version": "3.12.0"
340+
"version": "3.13.3"
341341
}
342342
},
343343
"nbformat": 4,

FANS_Dashboard/fans_dashboard/__init__.py

Whitespace-only changes.

FANS_Dashboard/fans_dashboard/core/__init__.py

Whitespace-only changes.
File renamed without changes.

0 commit comments

Comments
 (0)