From e8182dd157cbb29ff8370b60b86fdec88699aefb Mon Sep 17 00:00:00 2001 From: jstilley Date: Tue, 15 Oct 2024 15:25:48 -0700 Subject: [PATCH] Making unit tests more stable --- armi/reactor/blocks.py | 2 +- armi/reactor/tests/test_blocks.py | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/armi/reactor/blocks.py b/armi/reactor/blocks.py index 09f817fdf..969c7c57e 100644 --- a/armi/reactor/blocks.py +++ b/armi/reactor/blocks.py @@ -2402,7 +2402,7 @@ def autoCreateSpatialGrids(self, cornersUp=True): if numLocations != self.getNumPins(): raise ValueError( - "Cannot create spatialGrid, number of locations in rings{} not equal to pin number{}".format( + "Cannot create spatialGrid, number of locations in rings {} not equal to pin number {}".format( numLocations, self.getNumPins() ) ) diff --git a/armi/reactor/tests/test_blocks.py b/armi/reactor/tests/test_blocks.py index aecfb2b0d..94ec315fc 100644 --- a/armi/reactor/tests/test_blocks.py +++ b/armi/reactor/tests/test_blocks.py @@ -16,7 +16,9 @@ import io import math import os +import shutil import unittest +from glob import glob from unittest.mock import MagicMock, patch import numpy as np @@ -2333,8 +2335,22 @@ def test_validateCornersUp(self): def test_validateFlatsUp(self): """Validate the spatial grid for a flats up HexBlock and its children.""" + # copy the files over + inDir = os.path.join(TEST_ROOT, "smallestTestReactor") + for filePath in glob(os.path.join(inDir, "*.yaml")): + outPath = os.path.join(self.td.destination, os.path.basename(filePath)) + shutil.copyfile(filePath, outPath) + + # modify the reactor to make it flats up + testFile = os.path.join(self.td.destination, "refSmallestReactor.yaml") + txt = open(testFile, "r").read() + txt = txt.replace("geom: hex_corners_up", "geom: hex") + open(testFile, "w").write(txt) + # load a flats up reactor - _o, r = loadTestReactor(TEST_ROOT, inputFileName="armiRun.yaml") + _o, r = loadTestReactor( + self.td.destination, inputFileName="armiRunSmallest.yaml" + ) # grab a pinned fuel block, and verify it is flats up b = r.core.getFirstBlock(Flags.FUEL)