armi.tests package
General framework-wide testing functions and files.
This package contains some input files that can be used across a wide variety of unit tests in other lower-level subpackages.
- class armi.tests.Fixture(refDirectory, targets, dependencies, function)[source]
Bases:
objectFixture for presenting a consistent data source for testing.
A Fixture is a class that wraps a function which generates resources needed by one or more tests that does not need to be updated every time tests are run.
Do not use this class directly, instead use the
@fixtureand@requires_fixturedecorators.
- armi.tests.fixture(refDirectory=None, targets=None, dependencies=None)[source]
Decorator to run function based on targets and dependencies similar to GNU Make.
- Parameters:
refDirectory (str) – String reference directory for all targets/dependencies. This makes it possible to simplify file paths. If
os.path.abspath(<path>) == <path>, then refDirectory is not used.targets (iterable(str)) – List of targets that the function generates.
dependencies (iterable(str)) – List of dependencies that the
targetsrequire.
- armi.tests.requires_fixture(fixtureFunction)[source]
Decorator to require a fixture to have been completed.
- Parameters:
fixtureFunction (function without any parameters) – Fixture function is a function that has been decorated with fixture and is called prior to running the decorated function.
Notes
This cannot be used on classes.
- class armi.tests.ArmiTestHelper(methodName='runTest')[source]
Bases:
TestCaseClass containing common testing methods shared by many tests.
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- compareFilesLineByLine(expectedFilePath, actualFilePath, falseNegList=None, eps=None)[source]
Compare the contents of two files line by line.
Warning
The file located at actualFilePath will be deleted if they do match.
Some tests write text files that should be compared line-by-line with reference files. This method performs the comparison.
This class of test is not ideal but does cover a lot of functionality quickly. To assist in the maintenance burden, the following standards are expected and enforced:
The reference file compared against will be called either
[name]-ref.[ext]or[name].expected.The file that the test creates will be called
[name]-test.[ext]or[name].
- Parameters:
expectedFilePath (str) – Path to the reference or expected file
actualFilePath (str) – Path to the file that will be compared to
expectedFilePathfalseNegList (None or Iterable) – Optional argument. If two lines are not equal, then check if any values from
falseNegListare in this line. If so, do not fail the test.eps (float, optional) – If provided, try to determine if the only difference between compared lines is in the value of something that can be parsed into a float, and the relative difference between the two floats is below the passed eps.
- static compareLines(actual: str, expected: str, eps: float | None = None)[source]
Impl of line comparison for compareFilesLineByLine.
If rstripped lines are equal -> Good. Otherwise, split on whitespace and try to parse element pairs as floats. If they are both parsable, compare with relative eps, if provided. A side effect of the epsilon comparison is that differing whitespace between words is treated as irrelevant.
Submodules
- armi.tests.mockRunLogs module
- armi.tests.refSmallReactorShuffleLogic module
- armi.tests.test_apps module
TestPlugin1TestPlugin2TestPlugin3TestPlugin4TestAppsTestApps.test_getParamRenames()TestApps.test_registerPluginFlags()TestApps.test_getParamRenamesInvalids()TestApps.test_version()TestApps.test_getSettings()TestApps.test_splashText()TestApps.test_splashTextDifferentApp()TestApps.test_isStableReleaseVersion()TestApps.test_disableFutureConfigures()
TestArmiHighLevel
- armi.tests.test_armiTestHelper module
- armi.tests.test_cartesian module
- armi.tests.test_context module
- armi.tests.test_interfaces module
DummyInterfaceTestCodeInterfaceTestTightCouplerTestTightCoupler.test_couplerActive()TestTightCoupler.test_storePreviousIterationValue()TestTightCoupler.test_storePreviousIterationValueException()TestTightCoupler.test_isConvergedValueError()TestTightCoupler.test_isConverged()TestTightCoupler.test_isConvergedRuntimeError()TestTightCoupler.test_getListDimension()
- armi.tests.test_lwrInputs module
- armi.tests.test_mpiActions module
MockMpiCommMockMpiActionMpiIterTestsMpiIterTests.test_parallel()MpiIterTests.test_serialGather()MpiIterTests.test_mpiIter()MpiIterTests.test_perfectBalancing()MpiIterTests.test_excessProcesses()MpiIterTests.test_typicalBalancing()MpiIterTests.test_runActionsDistributionAction()MpiIterTests.test_runBatchedActions()MpiIterTests.test_runActionsDistributeStateAction()MpiIterTests.test_runActionsDistStateActionParallel()MpiIterTests.test_diagnosePickleErrorTestReactor()MpiIterTests.test_invokeAsMaster()
QueueActionsTests
- armi.tests.test_mpiFeatures module
- armi.tests.test_mpiParameters module
- armi.tests.test_notebooks module
- armi.tests.test_plugins module
- armi.tests.test_runLog module
TestRunLogTestRunLog.test_setVerbosityFromInteger()TestRunLog.test_setVerbosityFromString()TestRunLog.test_verbosityOutOfRange()TestRunLog.test_invalidSetVerbosityByString()TestRunLog.test_parentRunLogging()TestRunLog.test_getWhiteSpace()TestRunLog.test_warningReport()TestRunLog.test_warningReportInvalid()TestRunLog.test_closeLogging()TestRunLog.test_setVerbosity()TestRunLog.test_setVerbosityBeforeStartLog()TestRunLog.test_callingStartLogMultipleTimes()TestRunLog.test_deduplicationFilter()TestRunLog.test_concatenateLogs()TestRunLog.test_createLogDir()
TestRunLogger
- armi.tests.test_symmetry module
- armi.tests.test_tests module
- armi.tests.test_user_plugins module
UserPluginFlagsUserPluginFlags2UserPluginFlags3UserPluginBadDefinesSettingsUserPluginBadDefineParameterRenamesUserPluginOnProcessCoreLoadingUpInterfaceUserPluginWithInterfaceTestUserPluginsTestUserPlugins.test_userPluginsFlags()TestUserPlugins.test_validateUserPluginLimitations()TestUserPlugins.test_registerUserPlugins()TestUserPlugins.test_registerUserPluginsAbsPath()TestUserPlugins.test_registerUserPluginsFromSettings()TestUserPlugins.test_userPluginOnProcessCoreLoading()TestUserPlugins.test_userPluginWithInterfaces()TestUserPlugins.test_registerRepeatedUserPlugins()