From 9ea428bbbc196e80729e6153b2dc7e249d744aad Mon Sep 17 00:00:00 2001 From: John Stilley <1831479+john-science@users.noreply.github.com> Date: Fri, 30 Aug 2024 11:26:43 -0700 Subject: [PATCH] Adding --skip-inspection to compare-suites (#1842) --- armi/cases/suite.py | 12 ++++++++++-- armi/cli/compareCases.py | 13 ++++++++++++- armi/cli/tests/test_runEntryPoint.py | 3 ++- doc/release/0.4.rst | 1 + 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/armi/cases/suite.py b/armi/cases/suite.py index 7733c0b2f..222e2397c 100644 --- a/armi/cases/suite.py +++ b/armi/cases/suite.py @@ -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 @@ -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()), @@ -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): diff --git a/armi/cli/compareCases.py b/armi/cli/compareCases.py index b42e97f97..cd5acd157 100644 --- a/armi/cli/compareCases.py +++ b/armi/cli/compareCases.py @@ -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 @@ -188,6 +197,7 @@ def invoke(self): rootDir=self.args.reference, patterns=allTests, ignorePatterns=self.args.ignore, + skipInspection=self.args.skip_inspection, ) cmpSuite = cases.CaseSuite(self.cs) @@ -195,6 +205,7 @@ def invoke(self): rootDir=self.args.comparison, patterns=self.args.patterns, ignorePatterns=self.args.ignore, + skipInspection=self.args.skip_inspection, ) nIssues = refSuite.compare( @@ -206,4 +217,4 @@ def invoke(self): ) if nIssues > 0: - sys.exit(nIssues) + sys.exit(1) diff --git a/armi/cli/tests/test_runEntryPoint.py b/armi/cli/tests/test_runEntryPoint.py index 370200e26..b0e541d65 100644 --- a/armi/cli/tests/test_runEntryPoint.py +++ b/armi/cli/tests/test_runEntryPoint.py @@ -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) diff --git a/doc/release/0.4.rst b/doc/release/0.4.rst index d7f45a1c4..c61c6079c 100644 --- a/doc/release/0.4.rst +++ b/doc/release/0.4.rst @@ -10,6 +10,7 @@ New Features ------------ #. ARMI now supports Python 3.12. (`PR#1813 `_) #. Removing the ``tabulate`` dependency by ingesting it to ``armi.utils.tabulate``. (`PR#1811 `_) +#. Adding ``--skip-inspection`` flag to ``CompareCases`` CLI. (`PR#1842 `_) #. TBD API Changes