Skip to content

Commit

Permalink
Adding --skip-inspection to compare-suites (#1842)
Browse files Browse the repository at this point in the history
  • Loading branch information
john-science authored Aug 30, 2024
1 parent 93a7a94 commit 9ea428b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
12 changes: 10 additions & 2 deletions armi/cases/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ def __len__(self):
return len(self._cases)

def discover(
self, rootDir=None, patterns=None, ignorePatterns=None, recursive=True
self,
rootDir=None,
patterns=None,
ignorePatterns=None,
recursive=True,
skipInspection=False,
):
"""
Finds case objects by searching for a pattern of file paths, and adds them to
Expand All @@ -104,6 +109,8 @@ def discover(
file patterns to exclude matching file names
recursive : bool, optional
if True, recursively search for settings files
skipInspection : bool, optional
if True, skip running the check inputs
"""
csFiles = settings.recursivelyLoadSettingsFiles(
rootDir or os.path.abspath(os.getcwd()),
Expand All @@ -115,7 +122,8 @@ def discover(

for cs in csFiles:
case = armicase.Case(cs=cs, caseSuite=self)
case.checkInputs()
if not skipInspection:
case.checkInputs()
self.add(case)

def echoConfiguration(self):
Expand Down
13 changes: 12 additions & 1 deletion armi/cli/compareCases.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,15 @@ def addOptions(self):
default=[],
help="Pattern to search for inputs to ignore.",
)
self.parser.add_argument(
"--skip-inspection",
"-I",
action="store_true",
default=False,
help="Skip inspection. By default, setting files are checked for integrity and consistency. These "
"checks result in needing to manually resolve a number of differences. Using this option will "
"suppress the inspection step.",
)

def invoke(self):
from armi import cases
Expand All @@ -188,13 +197,15 @@ def invoke(self):
rootDir=self.args.reference,
patterns=allTests,
ignorePatterns=self.args.ignore,
skipInspection=self.args.skip_inspection,
)

cmpSuite = cases.CaseSuite(self.cs)
cmpSuite.discover(
rootDir=self.args.comparison,
patterns=self.args.patterns,
ignorePatterns=self.args.ignore,
skipInspection=self.args.skip_inspection,
)

nIssues = refSuite.compare(
Expand All @@ -206,4 +217,4 @@ def invoke(self):
)

if nIssues > 0:
sys.exit(nIssues)
sys.exit(1)
3 changes: 2 additions & 1 deletion armi/cli/tests/test_runEntryPoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,11 @@ def test_compareSuitesBasics(self):
with TemporaryDirectoryChanger():
cs = CompareSuites()
cs.addOptions()
cs.parse_args(["/path/to/fake1.h5", "/path/to/fake2.h5"])
cs.parse_args(["/path/to/fake1.h5", "/path/to/fake2.h5", "-I"])

self.assertEqual(cs.name, "compare-suites")
self.assertEqual(cs.args.reference, "/path/to/fake1.h5")
self.assertTrue(cs.args.skip_inspection)
self.assertIsNone(cs.args.weights)


Expand Down
1 change: 1 addition & 0 deletions doc/release/0.4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ New Features
------------
#. ARMI now supports Python 3.12. (`PR#1813 <https://github.com/terrapower/armi/pull/1813>`_)
#. Removing the ``tabulate`` dependency by ingesting it to ``armi.utils.tabulate``. (`PR#1811 <https://github.com/terrapower/armi/pull/1811>`_)
#. Adding ``--skip-inspection`` flag to ``CompareCases`` CLI. (`PR#1842 <https://github.com/terrapower/armi/pull/1842>`_)
#. TBD

API Changes
Expand Down

0 comments on commit 9ea428b

Please sign in to comment.