diff --git a/.github/workflows/unittests.yaml b/.github/workflows/unittests.yaml index 3e0b66db2..a7271814e 100644 --- a/.github/workflows/unittests.yaml +++ b/.github/workflows/unittests.yaml @@ -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 diff --git a/armi/bookkeeping/db/tests/test_comparedb3.py b/armi/bookkeeping/db/tests/test_comparedb3.py index a19b94950..2b07a3dc9 100644 --- a/armi/bookkeeping/db/tests/test_comparedb3.py +++ b/armi/bookkeeping/db/tests/test_comparedb3.py @@ -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") diff --git a/armi/utils/tests/test_pathTools.py b/armi/utils/tests/test_pathTools.py index 2b6f046db..8ac3affe0 100644 --- a/armi/utils/tests/test_pathTools.py +++ b/armi/utils/tests/test_pathTools.py @@ -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 @@ -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(): @@ -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(