Skip to content

Commit

Permalink
Merge branch 'main' into drewj/rotate-block-params/1860
Browse files Browse the repository at this point in the history
  • Loading branch information
drewj-tp committed Sep 20, 2024
2 parents 586b850 + 3dd2763 commit 52f7d50
Show file tree
Hide file tree
Showing 29 changed files with 177 additions and 162 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ on:
paths-ignore:
- 'doc/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
# Deploying coverage to coveralls.io should not happen on forks
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
# Building and deploying docs is broken on forked repos
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/mac_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ permissions:

on:
push:
branches:
- main
paths-ignore:
- 'doc/**'
pull_request:
paths-ignore:
- 'doc/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/unittests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ on:
paths-ignore:
- 'doc/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:

Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/wintests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ permissions:

on:
push:
branches:
- main
paths-ignore:
- 'doc/**'
pull_request:
paths-ignore:
- 'doc/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:

Expand Down
2 changes: 1 addition & 1 deletion armi/bookkeeping/db/tests/test_comparedb3.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def test_compareDatabaseSim(self):
inputFileName="smallestTestReactor/armiRunSmallest.yaml",
)

# create two DBs, identical but for file names
# create two DBs, identical but for file names and cycle lengths
dbs = []
for lenCycle in range(1, 3):
# build some test data
Expand Down
1 change: 0 additions & 1 deletion armi/bookkeeping/db/tests/test_database3.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,6 @@ def test_auxData(self):
with self.assertRaises(KeyError):
self.db.genAuxiliaryData((-1, -1))

# TODO: This should be expanded.
def test_replaceNones(self):
"""Super basic test that we handle Nones correctly in database read/writes."""
data3 = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
Expand Down
18 changes: 1 addition & 17 deletions armi/bookkeeping/report/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,6 @@ class Link(Tag):
tag = "link"


# ---------------------------


def encode64(file_path):
"""Return the embedded HTML src attribute for an image in base64."""
xtn = os.path.splitext(file_path)[1][1:] # [1:] to cut out the period
Expand All @@ -195,9 +192,6 @@ def encode64(file_path):
)


# ---------------------------


def writeStandardReportTemplate(f, report, caseTitle=""):
f.write(r"<!DOCTYPE html>" + "\n")
with Html(f):
Expand All @@ -222,17 +216,7 @@ def writeStandardReportTemplate(f, report, caseTitle=""):
with Span(
f, attrs={"class": "navbar-text navbar-version pull-left"}
):
with Img(
f,
attrs={
"src": encode64(
os.path.join(
context.RES, "images", "armiicon.ico"
)
)
},
):
pass
pass

with A(
f,
Expand Down
117 changes: 30 additions & 87 deletions armi/nuclearDataIO/tests/test_xsLibraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
UFG_FLUX_EDIT = os.path.join(FIXTURE_DIR, "mc2v3-AA.flux_ufg")


class TempFileMixin(unittest.TestCase):
"""really a test case."""
class TempFileMixin:
"""Not a test; just helpful test tooling."""

def setUp(self):
self.td = TemporaryDirectoryChanger()
Expand All @@ -71,7 +71,7 @@ def testFileName(self):
)


class TestXSLibrary(TempFileMixin):
class TestXSLibrary(TempFileMixin, unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.isotxsAA = isotxs.readBinary(ISOTXS_AA)
Expand Down Expand Up @@ -228,7 +228,7 @@ def test_canWritePmatrxFromCombinedXSLibrary(self):
def _canWritefromCombined(self, writer, refFile):
if self.xsLibGenerationErrorStack is not None:
print(self.xsLibGenerationErrorStack)
raise Exception("see stdout for stack trace")
raise Exception("See stdout for stack trace")
# check to make sure they labels overlap... or are actually the same
writer.writeBinary(self.xsLib, self.testFileName)
self.assertTrue(filecmp.cmp(refFile, self.testFileName))
Expand Down Expand Up @@ -287,45 +287,23 @@ def assert_contains_only(self, container, shouldBeThere, shouldNotBeThere):
self.assertEqual(set(), container & set(shouldNotBeThere))


class TestXSlibraryMerging(TempFileMixin):
class AbstractTestXSlibraryMerging(TempFileMixin):
"""
A shared class that defines tests that should be true for all IsotxsLibrary merging.
Notes
-----
This is just a base class, so it isn't run directly.
This is just a base class, it isn't run directly.
"""

@classmethod
def setUpClass(cls):
cls.libAA = None
cls.libAB = None
cls.libCombined = None
cls.libLumped = None

@classmethod
def tearDownClass(cls):
cls.libAA = None
cls.libAB = None
cls.libCombined = None
cls.libLumped = None
del cls.libAA
del cls.libAB
del cls.libCombined
del cls.libLumped

def setUp(self):
TempFileMixin.setUp(self)
# load a library that is in the ARMI tree. This should
# be a small library with LFPs, Actinides, structure, and coolant
for attrName, path in [
("libAA", self.getLibAAPath),
("libAB", self.getLibABPath),
("libCombined", self.getLibAA_ABPath),
("libLumped", self.getLibLumpedPath),
]:
if getattr(self.__class__, attrName) is None:
setattr(self.__class__, attrName, self.getReadFunc()(path()))
# Load a library that is in the ARMI tree. This should be a small library with LFPs,
# Actinides, structure, and coolant
self.libAA = self.getReadFunc()(self.getLibAAPath())
self.libAB = self.getReadFunc()(self.getLibABPath())
self.libCombined = self.getReadFunc()(self.getLibAA_ABPath())
self.libLumped = self.getReadFunc()(self.getLibLumpedPath())

def getErrorType(self):
raise NotImplementedError()
Expand Down Expand Up @@ -368,16 +346,16 @@ def test_cannotMergeXSLibxWithDifferentGroupStructure(self):
def test_mergeEmptyXSLibWithOtherEssentiallyClonesTheOther(self):
emptyXSLib = xsLibraries.IsotxsLibrary()
emptyXSLib.merge(self.libAA)
self.__class__.libAA = None
self.libAA = None
self.getWriteFunc()(emptyXSLib, self.testFileName)
self.assertTrue(filecmp.cmp(self.getLibAAPath(), self.testFileName))

def test_mergeTwoXSLibFiles(self):
emptyXSLib = xsLibraries.IsotxsLibrary()
emptyXSLib.merge(self.libAA)
self.__class__.libAA = None
self.libAA = None
emptyXSLib.merge(self.libAB)
self.__class__.libAB = None
self.libAB = None
self.assertEqual(
set(self.libCombined.nuclideLabels), set(emptyXSLib.nuclideLabels)
)
Expand All @@ -388,9 +366,9 @@ def test_mergeTwoXSLibFiles(self):
def test_canRemoveIsotopes(self):
emptyXSLib = xsLibraries.IsotxsLibrary()
emptyXSLib.merge(self.libAA)
self.__class__.libAA = None
self.libAA = None
emptyXSLib.merge(self.libAB)
self.__class__.libAB = None
self.libAB = None
for nucId in [
"ZR93_7",
"ZR95_7",
Expand All @@ -414,7 +392,7 @@ def test_canRemoveIsotopes(self):
self.assertTrue(filecmp.cmp(self.getLibLumpedPath(), self.testFileName))


class Pmatrx_merge_Tests(TestXSlibraryMerging):
class Pmatrx_Merge_Tests(AbstractTestXSlibraryMerging, unittest.TestCase):
def getErrorType(self):
return OSError

Expand Down Expand Up @@ -448,7 +426,7 @@ def test_cannotMergeXSLibsWithDifferentGammaGroupStructures(self):
dummyXsLib.merge(self.libCombined)


class Isotxs_merge_Tests(TestXSlibraryMerging):
class Isotxs_Merge_Tests(AbstractTestXSlibraryMerging, unittest.TestCase):
def getErrorType(self):
return OSError

Expand All @@ -471,7 +449,7 @@ def getLibLumpedPath(self):
return ISOTXS_LUMPED


class Gamiso_merge_Tests(TestXSlibraryMerging):
class Gamiso_Merge_Tests(AbstractTestXSlibraryMerging, unittest.TestCase):
def getErrorType(self):
return OSError

Expand All @@ -494,56 +472,21 @@ def getLibLumpedPath(self):
return GAMISO_LUMPED


class Combined_merge_Tests(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.isotxsAA = None
cls.isotxsAB = None
cls.gamisoAA = None
cls.gamisoAB = None
cls.pmatrxAA = None
cls.pmatrxAB = None
cls.libCombined = None

@classmethod
def tearDownClass(cls):
cls.isotxsAA = None
cls.isotxsAB = None
cls.gamisoAA = None
cls.gamisoAB = None
cls.pmatrxAA = None
cls.pmatrxAB = None
cls.libCombined = None
del cls.isotxsAA
del cls.isotxsAB
del cls.gamisoAA
del cls.gamisoAB
del cls.pmatrxAA
del cls.pmatrxAB
del cls.libCombined

class Combined_Merge_Tests(unittest.TestCase):
def setUp(self):
# load a library that is in the ARMI tree. This should
# be a small library with LFPs, Actinides, structure, and coolant
for attrName, path, readFunc in [
("isotxsAA", ISOTXS_AA, isotxs.readBinary),
("gamisoAA", GAMISO_AA, gamiso.readBinary),
("pmatrxAA", PMATRX_AA, pmatrx.readBinary),
("isotxsAB", ISOTXS_AB, isotxs.readBinary),
("gamisoAB", GAMISO_AB, gamiso.readBinary),
("pmatrxAB", PMATRX_AB, pmatrx.readBinary),
("libCombined", ISOTXS_AA_AB, isotxs.readBinary),
]:
if getattr(self.__class__, attrName) is None:
setattr(self.__class__, attrName, readFunc(path))
# Load a library that is in the ARMI tree. This should be a small library with LFPs,
# Actinides, structure, and coolant
self.isotxsAA = isotxs.readBinary(ISOTXS_AA)
self.gamisoAA = gamiso.readBinary(GAMISO_AA)
self.pmatrxAA = pmatrx.readBinary(PMATRX_AA)
self.isotxsAB = isotxs.readBinary(ISOTXS_AB)
self.gamisoAB = gamiso.readBinary(GAMISO_AB)
self.pmatrxAB = pmatrx.readBinary(PMATRX_AB)
self.libCombined = isotxs.readBinary(ISOTXS_AA_AB)

def test_mergeAllXSLibFiles(self):
lib = xsLibraries.IsotxsLibrary()
xsLibraries.mergeXSLibrariesInWorkingDirectory(
lib, xsLibrarySuffix="", mergeGammaLibs=True, alternateDirectory=FIXTURE_DIR
)
self.assertEqual(set(lib.nuclideLabels), set(self.libCombined.nuclideLabels))


# Remove the abstract class, so that it does not run (all tests would fail)
del TestXSlibraryMerging
4 changes: 2 additions & 2 deletions armi/physics/fuelCycle/fuelHandlerInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def makeShuffleReport(self):
This can be used to export shuffling to an external code or to
perform explicit repeat shuffling in a restart.
It creates a ``*SHUFFLES.txt`` file based on the Reactor.moveList structure
It creates a ``*SHUFFLES.txt`` file based on the Reactor.moves structure
See Also
--------
Expand All @@ -155,7 +155,7 @@ def makeShuffleReport(self):
# remember, we put cycle 0 in so we could do BOL branch searches.
# This also syncs cycles up with external physics kernel cycles.
out.write("Before cycle {0}:\n".format(cycle + 1))
movesThisCycle = self.r.core.moveList.get(cycle)
movesThisCycle = self.r.core.moves.get(cycle)
if movesThisCycle is not None:
for (
fromLoc,
Expand Down
5 changes: 1 addition & 4 deletions armi/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,7 @@
from armi import pluginManager
from armi.utils import flags

# Not used during runtime so we could have a coverage drop here. Add the
# pragma line to tell coverage.py to skip this
# https://coverage.readthedocs.io/en/stable/excluding.html
if TYPE_CHECKING: # pragma: no cover
if TYPE_CHECKING:
from armi.reactor.composites import Composite


Expand Down
6 changes: 1 addition & 5 deletions armi/reactor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@

from armi import plugins

# Provide type checking but avoid circular imports
# Not used during runtime so we could have a coverage drop here. Add the
# pragma line to tell coverage.py to skip this
# https://coverage.readthedocs.io/en/stable/excluding.html
if TYPE_CHECKING: # pragma: no cover
if TYPE_CHECKING:
from armi.reactor.reactors import Core
from armi.reactor.assemblyLists import SpentFuelPool

Expand Down
1 change: 0 additions & 1 deletion armi/reactor/blueprints/tests/test_blockBlueprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ def test_explicitFlags(self):
self.assertTrue(a1.hasFlags(Flags.FUEL, exact=True))
self.assertTrue(a2.hasFlags(Flags.FUEL | Flags.TEST, exact=True))

# TODO: This test passes, but shouldn't.
def test_densityConsistentWithComponentConstructor(self):
a1 = self.blueprints.assemDesigns.bySpecifier["IC"].construct(
self.cs, self.blueprints
Expand Down
Loading

0 comments on commit 52f7d50

Please sign in to comment.