Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix add option #543

Merged
merged 6 commits into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion armi/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
Metadata describing an ARMI distribution.
"""

__version__ = "0.2.1"
__version__ = "0.2.2"
2 changes: 1 addition & 1 deletion armi/settings/setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def __copy__(self):
isEnvironment=bool(self.isEnvironment),
oldNames=None if self.oldNames is None else list(self.oldNames),
)
setting.value = copy.deepcopy(self._value)
setting._value = copy.deepcopy(self._value)
return setting


Expand Down
38 changes: 38 additions & 0 deletions armi/settings/tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@

import armi
from armi.physics.fuelCycle import FuelHandlerPlugin
from armi.physics.neutronics import settings as neutronicsSettings
from armi import settings
from armi.settings import caseSettings
from armi.settings import setting
from armi.operators import settingsValidation
from armi.tests import TEST_ROOT
from armi import plugins
from armi.utils import directoryChangers
from armi.reactor.flags import Flags
Expand Down Expand Up @@ -64,6 +66,16 @@ def defineSettings():
]


class PluginAddsOptions(plugins.ArmiPlugin):
@staticmethod
@plugins.HOOKIMPL
def defineSettings():
return [
setting.Option("MCNP", "neutronicsKernel"),
setting.Option("MCNP_Slab", "neutronicsKernel"),
]


class TestCaseSettings(unittest.TestCase):
def setUp(self):
self.cs = caseSettings.Settings()
Expand All @@ -86,6 +98,32 @@ def test_updateEnvironmentSettingsFrom(self):
self.assertEqual(self.cs["verbosity"], "9")


class TestAddingOptions(unittest.TestCase):
def setUp(self):
self.dc = directoryChangers.TemporaryDirectoryChanger()
self.dc.__enter__()

def tearDown(self):
self.dc.__exit__(None, None, None)

def test_addingOptions(self):
# load in the plugin with extra, added options
pm = armi.getPluginManagerOrFail()
pm.register(PluginAddsOptions)

# modify the default/text settings YAML file to include neutronicsKernel
fin = os.path.join(TEST_ROOT, "armiRun.yaml")
txt = open(fin, "r").read()
txt = txt.replace("\n nodeGroup:", "\n neutronicsKernel: MCNP\n nodeGroup:")
fout = "test_addingOptions.yaml"
open(fout, "w").write(txt)

# this settings file should load fine, and test some basics
cs = settings.Settings(fout)
self.assertEqual(cs["burnSteps"], 2)
self.assertEqual(cs["neutronicsKernel"], "MCNP")


class TestSettings2(unittest.TestCase):
def setUp(self):
# We are going to be messing with the plugin manager, which is global ARMI
Expand Down
20 changes: 18 additions & 2 deletions doc/release/0.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ ARMI v0.2 Release Notes
=======================


ARMI v0.2.2
ARMI v0.2.3
===========
Release Date: TBD

What's new in ARMI v0.2.2
What's new in ARMI v0.2.3
-------------------------
#. TBD

Expand All @@ -16,6 +16,22 @@ Bug fixes
#. TBD


ARMI v0.2.2
===========
Release Date: 2022-01-19

What's new in ARMI v0.2.2
-------------------------
#. Improved type hinting
#. Flushed out the ability to build the docs as PDF
#. Material modifications can now be made per-component
#. The ``loadOperator`` method now has the optional ``allowMissing`` argument

Bug fixes
---------
#. Fixed issue where copying a Setting with a defined list of options would throw an error (`PR#540 <https://github.com/terrapower/armi/pull/540>`_)


ARMI v0.2.1
===========
Release Date: 2022-01-13
Expand Down