Skip to content

Commit

Permalink
Merge branch 'main' into endf_setting
Browse files Browse the repository at this point in the history
  • Loading branch information
john-science committed Nov 5, 2024
2 parents f446921 + dae5b78 commit 0440843
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/unittests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ jobs:
run: |
pip install -e .[memprof,mpi,test]
pytest -n 4 armi
mpiexec -n 2 --use-hwthread-cpus coverage run --rcfile=pyproject.toml -m pytest --cov=armi --cov-config=pyproject.toml --ignore=venv armi/tests/test_mpiFeatures.py || true
mpiexec -n 2 --use-hwthread-cpus coverage run --rcfile=pyproject.toml -m pytest --cov=armi --cov-config=pyproject.toml --ignore=venv armi/tests/test_mpiParameters.py || true
mpiexec -n 2 --use-hwthread-cpus coverage run --rcfile=pyproject.toml -m pytest --cov=armi --cov-config=pyproject.toml --ignore=venv armi/utils/tests/test_directoryChangersMpi.py || true
mpiexec -n 2 --use-hwthread-cpus pytest armi/tests/test_mpiFeatures.py
mpiexec -n 2 --use-hwthread-cpus pytest armi/tests/test_mpiParameters.py
mpiexec -n 2 --use-hwthread-cpus pytest armi/utils/tests/test_directoryChangersMpi.py
8 changes: 5 additions & 3 deletions armi/bookkeeping/db/tests/test_comparedb3.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,15 +228,17 @@ def test_diffSpecialData(self):
refData4 = f4.create_dataset("numberDensities", data=a2)
refData4.attrs["shapes"] = "2"
refData4.attrs["numDens"] = a2
refData4.attrs["specialFormatting"] = True
f5 = h5py.File("test_diffSpecialData5.hdf5", "w")
srcData5 = f5.create_dataset("numberDensities", data=a2)
srcData5.attrs["shapes"] = "2"
srcData5.attrs["numDens"] = a2
srcData5.attrs["specialFormatting"] = True

# there should an exception
with self.assertRaises(Exception) as e:
# there should a log message
with mockRunLogs.BufferLog() as mock:
_diffSpecialData(refData4, srcData5, out, dr)
self.assertIn("Unable to unpack special data for paramName", e)
self.assertIn("Unable to unpack special data for", mock.getStdout())

# make an H5 datasets that will add a np.inf diff because keys don't match
f6 = h5py.File("test_diffSpecialData6.hdf5", "w")
Expand Down
15 changes: 7 additions & 8 deletions armi/utils/tests/test_pathTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import unittest

from armi import context
from armi.tests import mockRunLogs
from armi.utils import pathTools
from armi.utils.directoryChangers import TemporaryDirectoryChanger

Expand All @@ -36,11 +37,10 @@ def test_copyOrWarnFile(self):
pathTools.copyOrWarn("Test File", path, pathCopy)
self.assertTrue(os.path.exists(pathCopy))

# Test an exception
with self.assertRaises(Exception) as e:
# Test a non-existant file
with mockRunLogs.BufferLog() as mock:
pathTools.copyOrWarn("Test File", "FileDoesntExist.txt", pathCopy)
self.assertIn("Could not copy", e)
self.assertIn("No such file or directory", e)
self.assertIn("Could not copy", mock.getStdout())

def test_copyOrWarnDir(self):
with TemporaryDirectoryChanger():
Expand All @@ -55,11 +55,10 @@ def test_copyOrWarnDir(self):
self.assertTrue(os.path.exists(pathDirCopy))
self.assertTrue(os.path.exists(os.path.join(pathDirCopy, "test.txt")))

# Test an exception
with self.assertRaises(Exception) as e:
# Test a non-existant file
with mockRunLogs.BufferLog() as mock:
pathTools.copyOrWarn("Test File", "DirDoesntExist", pathDirCopy)
self.assertIn("Could not copy", e)
self.assertIn("No such file or directory", e)
self.assertIn("Could not copy", mock.getStdout())

def test_separateModuleAndAttribute(self):
self.assertRaises(
Expand Down

0 comments on commit 0440843

Please sign in to comment.