armi icon indicating copy to clipboard operation
armi copied to clipboard

Organize the `armi/tests/` directory and `armi/testing/` module

Open john-science opened this issue 1 year ago • 4 comments

The armi/tests/ directory has a bunch of unorganized data files. I would like these to be organized.

For instance, there are three YAML files to define the ZPPR benchmark reactor, those could go in their own directory!

Listed here are the data files, and where I would like them to go (with some notes about downstream repos that will need to be touched):

├── armi/tests/
└── anl-afci-177/
    ├── anl-afci-177-blueprints.yaml
    ├── anl-afci-177-fuelManagement.py
    ├── anl-afci-177.yaml
    ├── anl-afci-177-coreMap.yaml
└── c5g7/
    ├── c5g7-blueprints.yaml
    ├── c5g7-settings.yaml
└── resources/
    ├── armiRun-SHUFFLES.txt
    ├── COMPXS.ascii
    ├── geom.xml
    ├── geom1Assem.xml
    ├── ISOAA  (easy, because of the ISOAA_PATH variable)
└── sodiumHexReactor/  (downstream: cluster, deplection, neutronics, rxcoeffs)
    ├── armiRun.yaml
    ├── refSmallReactorShuffleLogic.py
    ├── refSmallReactor.yaml
    ├── refSmallSfpGrid.yaml
    ├── refSmallCoreGrid.yaml
    ├── refSmallReactorBase.yaml
└── thetarz/  (downstream: neutronics)
    ├── ThRZGeom.xml
    ├── ThRZloading.yaml
    ├── ThRZSettings.yaml
    ├── trz_geom.xml
└── zppr/  (downstream: mcnp, neutronics)
    ├── 1DslabXSByCompTest.yaml
    ├── zpprTest.yaml
    ├── zpprTestGeom.xml

I expect this to be done in stages, because it will require cleanup downstream:

  • [x] anl-afci-177/
  • [x] c5g7/
  • [ ] resources/
  • [ ] sodiumHexReactor/
  • [ ] thetarz/
  • [ ] zppr/

john-science avatar Sep 11 '24 21:09 john-science

Also, while we're at it, when not add a comment at the top of these files explaining what is in them, and what they are for.

Let's go nuts!

john-science avatar Sep 11 '24 22:09 john-science

Other strange or messy things in ARMI I should investigate:

The book keeping test file _constants.py seems silly.

john-science avatar Sep 11 '24 23:09 john-science

Here is a full list of everything I can find downstream where people are directly importing from the ARMI unit tests.

I would very much like to expunge ALL of these, so the ARMI unit tests can be removed from the API:

  • from armi.materials.tests.test_materials import _Material_Test
  • from armi.nuclearDataIO.cccc.tests.test_labels import THIS_DIR
  • from armi.nuclearDataIO.tests import test_xsLibraries # DLAYXS_MCC3, UFG_FLUX_EDIT, PMATRX_AA, ISOTXS_AA
  • from armi.nuclearDataIO.tests.test_xsCollections import MockBlock
  • from armi.physics.neutronics.fissionProductModel.tests.test_lumpedFissionProduct import getDummyLFPFile
  • from armi.physics.neutronics.globalFlux.tests.test_globalFluxInterface import applyDummyFlux
  • from armi.physics.neutronics.latticePhysics.tests.test_latticeInterface import TestLatticePhysicsInterface
  • from armi.reactor.converters.tests.test_axialExpansionChanger import AxialExpansionTestBase
  • from armi.reactor.converters.tests.test_axialExpansionChanger import buildTestAssemblyWithFakeMaterial
  • from armi.reactor.tests.test_assemblies import buildTestAssemblies
  • from armi.reactor.tests.test_blocks import buildSimpleFuelBlock
  • from armi.reactor.tests.test_blocks import loadTestBlock
  • from armi.reactor.tests.test_components import TestShapedComponent
  • from armi.reactor.tests.test_reactors import buildOperatorOfEmptyHexBlocks
  • from armi.tests import ARMI_RUN_PATH
  • from armi.tests import ArmiTestHelper
  • from armi.tests import getEmptyHexReactor
  • from armi.tests import ISOAA_PATH
  • from armi.tests import mockRunLogs
  • from armi.tests import TEST_ROOT
  • from armi.tests.test_plugins import TestPlugin

We have a few options for removing the need for these imports downstream:

  1. Move the test utility into armi.testing
  2. Help the downstream dev refactor their test
  3. Copy the test code into the downstream repo

john-science avatar Jan 06 '25 22:01 john-science

I have had a request from @keckler to ensure that mockRunLogs.py makes its way into the new armi/testing/ module.

I think that is a very high priority item to keep. Agreed.

john-science avatar Jan 15 '25 19:01 john-science