Skip to content

Commit

Permalink
Making unit tests more stable
Browse files Browse the repository at this point in the history
  • Loading branch information
john-science committed Oct 15, 2024
1 parent 7d8ab19 commit e8182dd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion armi/reactor/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)
)
Expand Down
18 changes: 17 additions & 1 deletion armi/reactor/tests/test_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit e8182dd

Please sign in to comment.